Lookup Formula Explanation Please

Arts

Well-known Member
Joined
Sep 28, 2007
Messages
775
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all

I have the below formula which gives me the last value in a range :
=LOOKUP(2,1/(A1:A10),A1:A10)

5624
78
65
74
45
99
24

My question is I was under the impression when using LOOKUP the numbers needed to be in ascending order so in order for the below to work this needs to be in the order 1,2,3,4,5 but for the above this isn't the case and returns what I need and was wondering why.

1731870403915.png


Any help on this is appreciated as always.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
It doesn't need to be in ascending order. That formula is looking for the number 2 in a range of numbers smaller than 2 (dividing 1 by the numbers makes all the numbers look something like this:

1731871652396.png


This results in it returning the last item in the range.
 
Upvote 0
hmmm

The below isn't in ascending order and the LOOKUP doesn't return the correct value as it did if it was :

=LOOKUP(I2,G2:G6,H2:H6)



5Maths3Physics
3Science
1Physics
4Chemistry
2Drama
 

Attachments

  • 1731872540726.png
    1731872540726.png
    9 KB · Views: 1
Upvote 0
That's because in that instance you're not creating a range where 1 is divided by all the values. Doing that makes all the values in the lookup range less than 1, so when searching for a 2 (or a value greater than 2), it won't find it, and instead gives you the last value in the return range.
 
Upvote 0
Ok so there is an aspect within the LOOKUP function the data needs to be in ascending order, I thought this was a necessity whenever it was being used.
 
Upvote 0
Have been over this but still do not fully understand the logic, any additional input/breakdown would be welcome. Perhaps if I ask this next question and then build my knowledge from there.

The below doesn't seem to work as the lookup_vector within the LOOKUP function isn't in ascending order, correct ?

=LOOKUP(I2,G2:G6,H2:H6)


5Maths3Physics
3Science
1Physics
4Chemistry
2Drama


My question would then be, When is an ascending order necessary within the LOOKUP formula?

Why does in one aspect to return the correct value of 3 (I get Physics and not Science ) this needs to be in ascending order but in order to attain the last value an ascending order isn't required.

* I shall log on tomorrow to check back in so not to come across as rude should I not reply.
 
Last edited:
Upvote 0
The 2,1/(array) formula is more or less a trick to get the last value. You're giving Excel a number of values lower than 2, so it cannot find 2 or a number greater than 2 and ends up giving you the last value in the result array.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

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