#N/A error with Lookup and Min functions

dallen8028

New Member
Joined
Jan 28, 2013
Messages
48
Good Afternoon everyone,

I have run into an issue using Lookup with Min. I can use Lookup with Max and get the required results, =LOOKUP(MAX(E7:E1000),E7:E1000,D7:D1000) actually gives the date that matches the Max value. When I change the formula to =LOOKUP(MIN(E7:E1000),E7:E1000,D7:D1000), it returns #N/A. I am looking for the date that matches the Min value. I noticed that there are more than one Min value (which is probably giving me the #N/A error). I do not know if this is actually the case and I do not know how to resolve it. Would someone be able to steer me in the right direction?

Thank you in Advance.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
It is okay for there to be more than one match; just understand that you cannot predict which one LOOKUP will choose.

Be sure that E7:E1000 is in ascending order. Otherwise, do the following:

=INDEX(D7:D1000, MATCH(MIN(E7:E1000),E7:E1000,0), 1)

Likewise when using MAX. LOOKUP(MAX...) might worked only by coincidence if E7:E1000 is not in ascending order.
 
Last edited:
Upvote 0
It is okay for there to be more than one match; just understand that you cannot predict which one LOOKUP will choose.

Be sure that E7:E1000 is in ascending order. Otherwise, do the following:

=INDEX(D7:D1000, MATCH(MIN(E7:E1000),E7:E1000,0), 1)

Likewise when using MAX. LOOKUP(MAX...) might worked only by coincidence if E7:E1000 is not in ascending order.


Thank you for your response Joeu2004, Your Formula worked great!

Still don't understand why the other didn't regarding the ascending order. The dates in Column D are Oldest to Newest. The numbers that are being looked at in Column E are random as they change daily. Does this make a difference?
 
Last edited:
Upvote 0
The numbers that are being looked at in Column E are random as they change daily. Does this make a difference?

No. I wrote: ``Be sure that E7:E1000 is in ascending order``.

Did the INDEX/MATCH formula work for you?
 
Upvote 0
Still don't understand why the other didn't regarding the ascending order.

Sorry: I misread your question. As I wrote: ``LOOKUP(MAX...) might [work] only by coincidence``. LOOKUP(MIN...) might work by coincidence, as well.

LOOKUP does a binary search. Go to the midpoint of rows 7:1000 (504). Step 2: If it equals what we want, we're done. If what we want is less than #504 , go to the midpoint of 7:503 (255), and go to Step 2. If what we want is greater than #504 , go to the midpoint of 504:1000 (752), and go to Step 2. If what we want is less than #7 , return #N/A. If it is greater than #1000 , return #1000 .

That algorithm works properly only if the data that we search is in ascending order. Otherwise, the results are unpredictable.
 
Upvote 0

Forum statistics

Threads
1,223,703
Messages
6,173,977
Members
452,540
Latest member
haasro02

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