Excel: How to return a column using Xlookup dynamically

5.4k Views Asked by At

Im trying to specify which column to return when using Xlookup but not sure how to go about this. Sample data below:

enter image description here

My formula =XLOOKUP(1,(C3:C6="Bob")*(D3:D6="LA"),G3:G6) gets the value of column G where name is Bob and city is LA returning 78.8 in this case. However I want to be able to dynamically specify which column is to be returned out of E,F & G similar to how Vlookup can specify a column number to return, because I wont know ahead of time which column to return. How can I specify the column number to return instead of hardcoding a range

1

There are 1 best solutions below

0
On BEST ANSWER

There are so many ways to do that. Try below one-

=XLOOKUP(1,(C3:C6="Bob")*(D3:D6="LA"),INDEX(E3:G6,,3))

enter image description here

Another way is using Index()/Match() combination.

=INDEX(E3:G6,MATCH("Bob" & "LA",C3:C6&D3:D6,0),3)