Broken Lookup Function?

tyija1995

Well-known Member
Joined
Feb 26, 2019
Messages
781
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I've recently encountered some strange behaviour using Excels LOOKUP function, and I can't figure out why it is doing this.

For now I have used an INDEX MATCH to get around this but I am still baffled, please see below:

Cell Formulas
RangeFormula
B2:B14B2=LOOKUP(2,1/(INDIRECT($A2&"!A:A")<>""),ROW(INDIRECT($A2&"!A:A")))
C2:C14C2=INDEX($F$2:$G$10,MATCH(LEFT(A2,FIND("_",A2)-1),$F$2:$F$10,0),2)
D2:D14D2=LOOKUP(LEFT(A2,FIND("_",A2)-1),$F$2:$F$10,$G$2:$G$10)


It is column D i am concerned with that is incorrect, column C is correct and B is just the row counts for each worksheet - any ideas on why col D is incorrect for some of the rows (highlighted) and not all??
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
For Lookup to work, you require to have the Column F sorted in ascending order. Once you sort it, the things will sort out itself as shown below.

Book1
ABCDEFG
1WorksheetRow Count (Column A)PersonBroken??ServerPerson
2Ares_G_27032020MattMattAresMatt
3Artemis_G_27032020NicoleNicoleArtemisNicole
4Awacdev_G_27032020HenryHenryAwacdevHenry
5Awacdev_H_27032020HenryHenryDemeterSadie
6Demeter_G_27032020SadieSadieHadesBatuhan
7Demeter_H_27032020SadieSadieHephaestusTom
8Hades_G_27032020BatuhanBatuhanMedusaMikaela
9Hades_H_27032020BatuhanBatuhanOracleHenry
10Hephaestus_G_27032020TomTomZeusJames
11Medusa_G_27032020MikaelaMikaela
12Oracle_G_27032020HenryHenry
13Oracle_H_27032020HenryHenry
14Zeus_G_27032020JamesJames
florida
Cell Formulas
RangeFormula
C2:C14C2=INDEX($F$2:$G$10,MATCH(LEFT(A2,FIND("_",A2)-1),$F$2:$F$10,0),2)
D2:D14D2=LOOKUP(LEFT(A2,FIND("_",A2)-1),$F$2:$F$10,$G$2:$G$10)
 
Upvote 0
Fantastic thank you so much! I had it working before I added the last 2 names - I shall amend the file now :)
 
Upvote 0
There is no need to alter the order if you don't want to as you can use VLOOKUP instead.

20 03 30.xlsm
ABCDEFG
1WorksheetRow Count (Column A)PersonBroken??ServerPerson
2Ares_G_27032020212MattMattAresMatt
3Artemis_G_2703202083NicoleNicoleArtemisNicole
4Awacdev_G_2703202011016HenryHenryDemeterSadie
5Awacdev_H_27032020847HenryHenryHadesBatuhan
6Demeter_G_27032020118SadieSadieHephaestusTom
7Demeter_H_2703202061SadieSadieMedusaMikaela
8Hades_G_2703202067BatuhanBatuhanZeusJames
9Hades_H_27032020638BatuhanBatuhanAwacdevHenry
10Hephaestus_G_2703202060783TomTomOracleHenry
11Medusa_G_2703202055MikaelaMikaela
12Oracle_G_2703202012055HenryHenry
13Oracle_H_2703202099652HenryHenry
14Zeus_G_27032020144JamesJames
Lookup
Cell Formulas
RangeFormula
D2:D14D2=VLOOKUP(LEFT(A2,FIND("_",A2)-1),$F$2:$G$10,2,0)
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,020
Members
448,939
Latest member
Leon Leenders

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