Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Lookup the last occurance of a value in a list

912 views
Skip to first unread message

Nav

unread,
Sep 7, 2006, 10:07:01 AM9/7/06
to
Hello

I am trying to find out if there is a way or work around to use vlookup in a
list where it finds the last occurance of an item and gives the corresponding
value in relation to it.
Eg.

Pear 5
Apple 5
Orange 3
Plum 2
Apple 1

I need it to look at the last occurance of Apple and return the value 1, but
the problem is the vlookup finds the first occurance only and returns 5.

Any ideas anyone.

Thank you in advance for any help.

Regards,
Nav

Don Guillett

unread,
Sep 7, 2006, 10:27:04 AM9/7/06
to
One way. This is an ARRAY formula which must be entered using
Ctrl+shift+enter
=INDIRECT("c"&MAX(IF(B1:B10="apple",ROW(A1:A10))))

--
Don Guillett
SalesAid Software
dguil...@austin.rr.com
"Nav" <N...@discussions.microsoft.com> wrote in message
news:A31A9F56-137A-4604...@microsoft.com...

Nav

unread,
Sep 7, 2006, 10:39:02 AM9/7/06
to
Hi

Do you know if this work with text too, or just numbers, as some of the data
are text.

Thank you.

Ron Rosenfeld

unread,
Sep 7, 2006, 11:05:44 AM9/7/06
to

You could use this **array** (entered with <ctrl><shift><enter> ) formula:

=INDEX(B1:B10,MAX(ROW(A1:A10)*(A1:A10="Apple")))

With your fruit in A1:A10 and your values in B1:B5.


--ron

Don Guillett

unread,
Sep 7, 2006, 11:24:11 AM9/7/06
to
Did you try it?

--
Don Guillett
SalesAid Software
dguil...@austin.rr.com
"Nav" <N...@discussions.microsoft.com> wrote in message

news:E6A808E2-E1BE-4B46...@microsoft.com...

Nav

unread,
Sep 7, 2006, 12:08:02 PM9/7/06
to
I tried it for both, but it didn't seem to work for either, not sure if I did
something wrong but I copied and pasted the below (with ctrl+shift+enter),
hence I was asking.

Thanks anyway.

Don Guillett

unread,
Sep 8, 2006, 8:15:50 AM9/8/06
to
This will work for either text or numbers in col B that you seek. It will
give the item in col C.
Perhaps you did not Array enter. You must use ctrl+shift+enter instead of
just enter.
=INDIRECT("c"&MAX(IF(B1:B11=1,ROW(A1:A11))))

--
Don Guillett
SalesAid Software
dguil...@austin.rr.com
"Nav" <N...@discussions.microsoft.com> wrote in message
news:DEF8B600-8548-4D77...@microsoft.com...
0 new messages