Searching UPWARDS for a value?

K

kinsham

Could anyone suggest worksheet functions that will allow me to search
UP a column for a given value, starting from a given position in the
column.

The vlookup function always searches down and so always returns the
first match rather than the last. I want to do this without having to
sort the data first.

Thanks
 
P

Peo Sjoblom

If you want the last occurrence of a lookup value if there are more than one
and you want to return a value from the same row so if the match is A12 and
you want B12 to be returned?

=INDEX(B2:B20,MAX((A2:A20=D1)*(ROW(A2:A20)))-1)

entered with ctrl + shift & enter

the -1 is to offset the number of cells for row 1, in this case the values
start in row2, if they started in row3 it would be -2 at the end, or change
the index range to always start from the first row (B1:B20) in this case

--


Regards,

Peo Sjoblom

Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
(remove ^^ from email)
 
G

Guest

Why do you want to search upward? If you include the "FALSE" at the end of
your vlookup, it won't matter what manner your data is sorted in. But the
"False" statement means you will only get the "exact" matches...and not
approximations.
 
B

Biff

Here's another one:

=LOOKUP(2,1/(A2:A20="X"),B2:B20)

Returns the value from column B that corresponds to the last instance of
"X".

Biff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top