Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel: How to return a column using Xlookup dynamically

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

like image 426
West Avatar asked Dec 19 '25 12:12

West


1 Answers

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)
like image 78
Harun24hr Avatar answered Dec 22 '25 10:12

Harun24hr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!