Error in lookup function?

gzuylen

New Member
Joined
Jul 5, 2013
Messages
2
Hi everyone,

I am doing a lookup, both the lookup vector and the result vector contain an incrementor, first rows is locked, second row not locked.
This gives the proper result until: LOOKUP(1;B$2:B8;A$2:A8) which gives 7 !

A workarroud is LOOKUP(1;1/B$2:B8;A$2:A8) this gives 3, because lookup ignores the #DIV/0! values.



Column A Column B=LOOKUP(1;B$2:B2;A$2:A2)
101
202
313
403
503
603
707
808
909
10010

<colgroup><col span="6"></colgroup><tbody>
</tbody>
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
hello gzuylen, welcome to MrExcel

In a "regular" LOOKUP function the lookup range, in this case B2:B8, needs to be sorted ascending - as that isn't the case you may get "unexpected" results. Try INDEX/MATCH like this

=INDEX(A$2:A2;MATCH(1;B$2:B2,0))
 
Upvote 0
I'm not sure exactly how you are required to select from column B before you find a match but you might try:

=IF(ISERROR(INDEX(A$2:A$11,MATCH(1,B$2:B2,0))),MAX(A$2:A2),INDEX(A$2:A$11,MATCH(1,B$2:B2,0)))

Note the different separator ( , versus ; ) if you are going to cut and paste.
 
Upvote 0
Ok, thanks.

I just was wandering why Excelisfun used LOOKUP(1;1/B$2:B8;A$2:A8)
and I produced this example.

It is the sorting thing!


 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

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