ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I lookup a table from right to left ? (https://www.excelbanter.com/excel-worksheet-functions/21408-how-do-i-lookup-table-right-left.html)

Daz9

How do I lookup a table from right to left ?
 
The Vlookup searches for a value in the leftmost column of a table, and then
returns a value in the same row from a column you specify in the table

Is is possible to use a lookup function to look up a value in the rightmost
column of a table and return a value in the same row from a column you
specify in the table (on the left hand side of the table) Basically the
reverse of the Vlookup

For example

I want to lookup the word black and return 5000

A B
1 5000 Black
2 1000 Red


Aladin Akyurek

=INDEX($A$2:$A$3,MATCH("Red",$B$2:$B$3,0))

If the table is sorted on its match range (i.e., B2:B3) and the
approximate return values are admissible:

=INDEX($A$2:$A$3,MATCH("Red",$B$2:$B$3,1))

or

=LOOKUP("Red",$B$2:$B$3,$A$2:$A$3)

If the table is sorted on its match range (i.e., B2:B3) and the
approximate return values are NOT admissible:

=IF(LOOKUP("Red",$B$2:$B$3)="Red",LOOKUP("Red",$B$ 2:$B$3,$A$2:$A$3),"")

Daz9 wrote:
The Vlookup searches for a value in the leftmost column of a table, and then
returns a value in the same row from a column you specify in the table

Is is possible to use a lookup function to look up a value in the rightmost
column of a table and return a value in the same row from a column you
specify in the table (on the left hand side of the table) Basically the
reverse of the Vlookup

For example

I want to lookup the word black and return 5000

A B
1 5000 Black
2 1000 Red



All times are GMT +1. The time now is 10:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com