ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Can VLookup return the LAST value in a range? (https://www.excelbanter.com/excel-worksheet-functions/169989-can-vlookup-return-last-value-range.html)

Steve

Can VLookup return the LAST value in a range?
 
If I have a list:
A 10
B 3
C 5
A 8
D 6

How can I get VLookup to return to value associated with the last occurance
of A instead of the first (i.e the value 8)?

Max

Can VLookup return the LAST value in a range?
 
One way, array-entered* in say, C1:
=INDEX($B$1:$B$10,MATCH(MAX(IF($A$1:$A$10="A",ROW( $A$1:$A$10))),IF($A$1:$A$10="A",ROW($A$1:$A$10)),0 ))

*press CTRL+SHIFT+ENTER to confirm the formula

Adapt the ranges to suit
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Steve" wrote:
If I have a list:
A 10
B 3
C 5
A 8
D 6

How can I get VLookup to return to value associated with the last occurance
of A instead of the first (i.e the value 8)?


Alan Beban[_2_]

Can VLookup return the LAST value in a range?
 
Max wrote:
One way, array-entered* in say, C1:
=INDEX($B$1:$B$10,MATCH(MAX(IF($A$1:$A$10="A",ROW( $A$1:$A$10))),IF($A$1:$A$10="A",ROW($A$1:$A$10)),0 ))

*press CTRL+SHIFT+ENTER to confirm the formula

Adapt the ranges to suit


Assumin that the list in A1:B5, if the functions in the
freelydownloadable file at http://home.pacbell.net/beban are available
to your workbook

=INDEX(VLookups("A",a1:b5,2),2)

Alan Beban

Dave Peterson

Can VLookup return the LAST value in a range?
 
Another one:
=LOOKUP(2,1/(A1:A5="a"),B1:B5)



Steve wrote:

If I have a list:
A 10
B 3
C 5
A 8
D 6

How can I get VLookup to return to value associated with the last occurance
of A instead of the first (i.e the value 8)?


--

Dave Peterson


All times are GMT +1. The time now is 09:10 PM.

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