I used an Index Match formula in Excel VBA to find part number and description for tools out of database. It was an Index-Match formula with to condintions. first look up a match in certain array for tool type of a machine and than match it to a configoration from certain array.
My problem is that I want to change to lookup way because with the formula I write specific range and I want it to be flexable so that if I add a new row in the database I would not need to change the code. the the databse is a table name "Illuminators".
That was the formula with to conditions I used before and as you can see there is a cell refernce and if i would add a new tool to the databse table under the array, it would not look for it there.
Selection.FormulaArray = "=INDEX(DB!R2C1:R21C7,MATCH(1,(DB_Illumiators!R2C1:R21C1=RC[1])*(DB_Illumiators!R2C2:R21C2=RC[2]),0),4)"
I use the formula in the main sheet in a loop and I use it from the databse work sheet in the second picture:
I will be grateful to those who help
Rafael
R2C1:R21C7
toC1:C7
or if you don't want to lookup an entire column (may be slow) change to something very large that you know data will not go beyond (e.g. -R2C1:R5000C7
– Scott Holtzman