Call row number after LOOKUP function

trijamms

New Member
Joined
Jan 7, 2015
Messages
8
Hi all,

I am trying to call the row number for a value, but there could be a duplicate, so I want to call the final cell with that value.

Here's the situation. I used this function (=LOOKUP(9.99E+307,B:B)) to get the value of the last cell a with a value in column B. This works fine. The last cell's value comes up just like I expected.

Then, I used the MATCH function to get the row number for the cell. Again, works just fine... Except that on occasion, I can have a duplicate come up in column B. If there's a duplicate, the MATCH function finds the first instance of the value found using LOOKUP and returns the wrong row number (the first instance rather than the last).

Any solutions?

Thanks for your help!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
One way is to use a helper column (col B in the example below) to distinguish between duplicate values (100 in the example below). Then the last of the altered duplicates has a slightly different value to match.
Excel Workbook
ABCD
111.0000018
222.000002
333.000003
4100100.000004
566.000005
655.000006
744.000007
8100100.00001
Sheet8
 
Upvote 0
Awesome! Totally worked Jonmo, thanks!

Can you explain why using that huge number causes Excel to look at the last entered cell? If I understood that, your solution would have been more apparent.
 
Upvote 0
Awesome! Totally worked Jonmo, thanks!

Can you explain why using that huge number causes Excel to look at the last entered cell? If I understood that, your solution would have been more apparent.

That huge number is an internal constant of Excel itself (It's not 999 or any other like 2^15, 1E100, 99^99, etc.). LOOKUP and kindred functions which do approximate match lands on the last numeric value in the reference they are given as a result of a binary search algorithm (which is very fast).

See for more:
http://www.mrexcel.com/forum/excel-questions/102091-9-9999999-a.html
http://www.mrexcel.com/forum/excel-...tiple-matches-match-returned.html#post1523998
 
Last edited:
Upvote 0
You're welcome

The Match is doing a 'closest match' lookup, which means it's searching for the largest number that is less than or equal to the lookup value.
The huge number just ensures ALL the numbers in the range will be Less Than the lookup value, therefore it returns the last number.
 
Upvote 0
You're welcome

The Match is doing a 'closest match' lookup, which means it's searching for the largest number that is less than or equal to the lookup value.
The huge number just ensures ALL the numbers in the range will be Less Than the lookup value, therefore it returns the last number.

The huge number doesn't ensure anything. It's the way the algorithm underlying LOOKUP, MATCH of closest match, etc. operates ensures the last value numeric result.
 
Upvote 0

Forum statistics

Threads
1,216,189
Messages
6,129,403
Members
449,509
Latest member
ajbooisen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top