jwitt98
jwitt98

Reputation: 1255

Excel using vlookup with index address match

I have a table similar to the one on the left in the image below. For each location, there are either 3 or 4 types. There are always Types 1, 2, and 4. Sometimes there is also a type 3. I need to find the type4 QtyC value for each location (highlighted in yellow) and move it to a table on the right. An example of a single row of that table can be seen on the right in the image below. In the example below, I am trying to move Location1, Type4, QtyC from cell E5 to cell I2 so that the end result should be 9 as highlighted in the table on the right.

Excel Problem

My thought was that I could use VLOOKUP in combination with OFFSET, ADDRESS, and MATCH, but Excel generates an error when I try to do this.

In the image above, you can see that:

=VLOOKUP(H2,OFFSET(A3,0,1,4,4),4,FALSE)

...returns 9 which is expected

=ADDRESS(MATCH(G2,A:A,0),1,4,1)

...returns A3 which is expected, but

=VLOOKUP(H2,OFFSET(ADDRESS(MATCH(G2,A:A,0),1,4,1),0,1,4,4),4,FALSE)

...returns an error.

I suspect it has something to do with the order in which excel is performing the calculations, but I can't seem to figure out a way to resolve this.

Any help or advice is appreciated!

Thanks

Upvotes: 0

Views: 664

Answers (1)

Axel Richter
Axel Richter

Reputation: 61915

The A3in the OFFSET formula is not a string but a cell reference. But ADDRESS will return a string and not a cell reference. INDEX will return a cell reference.

So

=VLOOKUP(H2,OFFSET(INDEX(A:A,MATCH(G2,A:A,0)),0,1,4,4),4,FALSE)

should do what you want.

Upvotes: 1

Related Questions