Best options for Index match when both source and lookup have numbers & text

CasualDabbler

New Member
Joined
Oct 29, 2018
Messages
19
Office Version
  1. 2016
Platform
  1. Windows
Good Afternoon everyone

My data contains numbers and text.
I.e. 13 & ABC1001
Depending on where I get my data from:-
  • sometimes the lists are values, so numbers will be as number and text as text.
  • sometimes the lists are text, so numbers will be as text and text as text. I.e. 13 may be listed as 0013
    • Is there a "Catch all" method which can lookup irrespective of data type in the source or the lookup table
  • If it helps, my text numbers are formatted as "0000", and could be any number from 0001 to 9999
On a side note, I previously saw somewhere that you can incorporate - or -- in the formula which I seem to think helped?
If anyone can advise & explain this it would be appreciated

Book2
ABCDEFGH
3Example of data as textReturn ValueExample of data as valuesReturn ValueValues to what to lookup
40038A38A0042Should return B, when looking in either data set
50042B42B42Should return B, when looking in either data set
60043C43CGAR1001Should return H, when looking in either data set
71091D1091D
81092E1092E
91093F1093F
10ABC1001GDLD1001G
11DEF1001HGAR1001H
12HGI0005IHAR0005I
13HGI0042JHGI0042J
14HGI9992KHAR9992K
15HGI1150LIND1150L
Sheet1
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I'm not sure how GAR1001 could return H from the left data set?

But see if this helps.

BTW, I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

21 09 21.xlsm
ABCDEFGHI
3Example of data as textReturn ValueExample of data as valuesReturn ValueValues to what to lookup
40038A38A0042BB
50042B42B42BB
60043C43CGAR1001#N/AH
71091D1091D
81092E1092E
91093F1093F
10ABC1001GDLD1001G
11DEF1001HGAR1001H
12HGI0005IHAR0005I
13HGI0042JHGI0042J
14HGI9992KHAR9992K
15HGI1150LIND1150L
Lookup
Cell Formulas
RangeFormula
H4:H6H4=INDEX(B$4:B$15,MATCH(TEXT(G4,"0000"),TEXT(A$4:A$15,"0000"),0))
I4:I6I4=INDEX(E$4:E$15,MATCH(TEXT(G4,"0000"),TEXT(D$4:D$15,"0000"),0))
 
Upvote 0
Using office 2016 - profile updated
Sorry - had a senior moment with the example data, corrected below.
Tried your suggestion, but it returns N/A on all results, which is strange as the formula builder suggest its finding the correct result - Can see what your doing with it and that seems the right way to attack this,

1632229419596.png


Book1
ABCDEFGHI
3Example of data as textReturn ValueExample of data as valuesReturn ValueValues to what to lookup
40038A38A0042#N/A#N/A
50042B42B42#N/A#N/A
60043C43CDEF1001#N/A#N/A
71091D1091D
81092E1092E
91093F1093F
10ABC1001GABC1001G
11DEF1001HDEF1001H
12HGI0005IHGI0005I
13HGI0042JHGI0042J
14HGI9992KHGI9992K
15HGI1150LHGI1150L
Sheet2
Cell Formulas
RangeFormula
H4:H6H4=INDEX(B$4:B$15,MATCH(TEXT(G4,"0000"),TEXT(A$4:A$15,"0000"),0))
I4:I6I4=INDEX(E$4:E$15,MATCH(TEXT(G4,"0000"),TEXT(D$4:D$15,"0000"),0))
 
Upvote 0
Try this: Select the formula cell and press F2 then re-confirm with Ctrl+Shift+Enter, not just Enter

Thanks for updating your profile. (y)
 
Upvote 0
Solution
Ahh, need to enter as an array - Thanks
If I have a lot of lookups (2,000), do you know if there is much processing different between entering a std Index match and one as an array
Wondering if its better to use an array or expend the effort cleaning the data (But I don't control the source, so have to do it every time I get a data update)
 
Upvote 0
2,000 lookups is not that much. I'd say give it a go and see what happens. :)
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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