Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default HLOOKUP last match in a table

In Excel, let's say I have the following in cells A1:B5:

ABC, ABC, ABC, XYZ, XYZ
12, 34, 56, 78, 90

I'm trying to create a formula that will find the last "ABC" in the
table, then return the number beneath it (in this case, 56). If I use
HLOOKUP("ABC", A1:B5, 2, TRUE), it seems to work, while if I change the
last paramter to FALSE it finds the first match. But the final
parameter for HLOOKUP -- boolean Range_Lookup -- is supposed to be
whether it's looking for an exact match or closest match. It doesn't
seem to have anything to do with finding the first or last match, so
while using it seems to work, it makes me nervous because I don't
understand why it works. Is there a better way to do this or can
someone tell me why using TRUE instead of FALSE for the final parameter
finds the last match? I'm using Excel 2000. Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default HLOOKUP last match in a table

This will work entered with ctrl + shift & enter

=INDEX(A1:E5,2,MAX((INDEX(A1:E5,1,)="ABC")*COLUMN( A1:E5)))

of course if you know you always will get the result from secon row there is
no need for INDEX

=INDEX(A2:E2,MAX((A1:E1="ABC")*COLUMN(A1:E1)))
--

Regards,

Peo Sjoblom

wrote in message
oups.com...
In Excel, let's say I have the following in cells A1:B5:

ABC, ABC, ABC, XYZ, XYZ
12, 34, 56, 78, 90

I'm trying to create a formula that will find the last "ABC" in the
table, then return the number beneath it (in this case, 56). If I use
HLOOKUP("ABC", A1:B5, 2, TRUE), it seems to work, while if I change the
last paramter to FALSE it finds the first match. But the final
parameter for HLOOKUP -- boolean Range_Lookup -- is supposed to be
whether it's looking for an exact match or closest match. It doesn't
seem to have anything to do with finding the first or last match, so
while using it seems to work, it makes me nervous because I don't
understand why it works. Is there a better way to do this or can
someone tell me why using TRUE instead of FALSE for the final parameter
finds the last match? I'm using Excel 2000. Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
Match function in a two input table Anh Excel Worksheet Functions 4 December 25th 05 10:07 PM
Trying to match a text string to a data table, any suggestions? OCONUS Excel Worksheet Functions 3 December 2nd 05 06:39 PM
Need help with HLOOKUP and MATCH functions BEAR94 Excel Worksheet Functions 1 August 12th 05 05:36 AM
Index & Match on Pivot Table Nelson Excel Discussion (Misc queries) 2 April 11th 05 02:16 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"