Hello gang...
I've noticed that if I use the VLOOKUP function with an existing table (this follows with HLOOKUP as well) as in Iteration 1 below, then modify my lookup table by inserting a column, the reference to the column returned in the VLOOKUP function does not update accordingly, which means I then have to manually modify the VLOOKUP formula.
My workaround is to use INDEX and MATCH as in Iteration 2 below. This allows me to cut and paste columns in the lookup table at will and the formulas still work. (As in Iteration 3, where the "COLOR" column was added after the fact.)
My question is whether or not there is a simpler, more elegent way (with shorter formulae) to recall relative return information from the lookup table while weathering the storm of lookup table revisions. I know I can use named ranges, but often the names of the ranges are longer than the cell callouts. In the spreadsheet I'm making, I'm also trying to make things as foolproof as possible which injects many IF's... For instance, the formula for cell D9 might read: =IF(C9="","",IF(INDEX(H9:H11,MATCH(C9,G9:G11,0),MATCH(D8,H8,0))="","Need item name",INDEX(H9:H11,MATCH(C9,G9:G11,0),MATCH(D8,H8,0))))
Any ideas on paring this down and still being able to insert columns or otherwise move lookup table information?
Thanks!
bobmc
I've noticed that if I use the VLOOKUP function with an existing table (this follows with HLOOKUP as well) as in Iteration 1 below, then modify my lookup table by inserting a column, the reference to the column returned in the VLOOKUP function does not update accordingly, which means I then have to manually modify the VLOOKUP formula.
My workaround is to use INDEX and MATCH as in Iteration 2 below. This allows me to cut and paste columns in the lookup table at will and the formulas still work. (As in Iteration 3, where the "COLOR" column was added after the fact.)
My question is whether or not there is a simpler, more elegent way (with shorter formulae) to recall relative return information from the lookup table while weathering the storm of lookup table revisions. I know I can use named ranges, but often the names of the ranges are longer than the cell callouts. In the spreadsheet I'm making, I'm also trying to make things as foolproof as possible which injects many IF's... For instance, the formula for cell D9 might read: =IF(C9="","",IF(INDEX(H9:H11,MATCH(C9,G9:G11,0),MATCH(D8,H8,0))="","Need item name",INDEX(H9:H11,MATCH(C9,G9:G11,0),MATCH(D8,H8,0))))
Any ideas on paring this down and still being able to insert columns or otherwise move lookup table information?
Thanks!
bobmc
Book1 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | Iteration1 | ITEMNO | ITEM | COST | ITEMNO | ITEM | COST | |||||
2 | 2 | Orange | $0.55 | 1 | Apple | $0.50 | ||||||
3 | 2 | Orange | $0.55 | |||||||||
4 | 3 | Banana | $0.75 | |||||||||
5 | ||||||||||||
6 | ||||||||||||
7 | ||||||||||||
8 | Iteration2 | ITEMNO | ITEM | COST | ITEMNO | ITEM | COST | |||||
9 | 2 | Orange | $0.55 | 1 | Apple | $0.50 | ||||||
10 | 2 | Orange | $0.55 | |||||||||
11 | 3 | Banana | $0.75 | |||||||||
12 | ||||||||||||
13 | ||||||||||||
14 | ||||||||||||
15 | Iteration3 | ITEMNO | ITEM | COST | ITEMNO | COLOR | ITEM | COST | ||||
16 | 2 | Orange | $0.55 | 1 | Red | Apple | $0.50 | |||||
17 | 2 | Orange | Orange | $0.55 | ||||||||
18 | 3 | Yellow | Banana | $0.75 | ||||||||
Sheet1 |