How to force xlookup value even if the lookup value and lookup array is different format (one is text & one is number)

fayez_MrExcel

Active Member
Joined
Oct 29, 2005
Messages
437
Office Version
  1. 365
Platform
  1. Windows
My lookup_value is in number format while my lookup_array is in text format, how can i avoid returning #N/A even if either lookup value and lookup array is in different format but the same number

Book5
ABCD
1Employee NumberMatch
211528207970#N/A
311649
411529
511525
61000407
7207970
8207972
9207975
10208114
1111651
12208022
13208044
1425185
Sheet1
Cell Formulas
RangeFormula
D2D2=MATCH(C2,$A$2:$A$14,0)
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
how about something like
=IFERROR(MATCH(C2,$A$2:$A$14,0),IFERROR(MATCH(C2*1,$A$2:$A$14,0),MATCH(TEXT(C2,0),$A$2:$A$14,0)))

so if c2 matches format - you will get 6
if an error
assuming the lookup is text
*1 to change to a value
if the array is text - then change the lookup value to text

left justified is text
right is a number

Book1
ABCD
1Employee NumberMatch
211528number text array2079706
311649text and text array2079706
411529text and number array115293
511525#N/A
61000407#N/A
7207970changed to text in array#N/A
8207972
9207975
10208114
1111651
12208022
13208044
1425185
Sheet1
Cell Formulas
RangeFormula
D2:D7D2=IFERROR(MATCH(C2,$A$2:$A$14,0),IFERROR(MATCH(C2*1,$A$2:$A$14,0),MATCH(TEXT(C2,0),$A$2:$A$14,0)))
 
Upvote 0
Not quite sure where you are headed as thread mentions XLOOKUP but your example used MATCH. :unsure:

What about this?

22 09 25.xlsm
ABCD
1Employee NumberMatch
2115282079706
311649
411529
511525
61000407
7207970
8207972
9207975
10208114
1111651
12208022
13208044
Mixed Values
Cell Formulas
RangeFormula
D2D2=MATCH(C2&"",$A$2:$A$14&"",0)
 
Upvote 0
Sorry for the confusion. Im actually doing the xlookup.

Book5
ABCD
1Employee NumberMatch
211528Hris207970#N/A
311649SFSupport
411529Security
511525ITHELP
61000407Anindita
7207970Admin
8207972Comp
9207975EC
10208114ExtensionServiceUser
1111651Abhishek
12208022PMGM
13208044PS
1425185sf
Sheet1
Cell Formulas
RangeFormula
D2D2=XLOOKUP(C2,$A$2:$A$14,$B$2:$B$14)



Not quite sure where you are headed as thread mentions XLOOKUP but your example used MATCH. :unsure:

What about this?

22 09 25.xlsm
ABCD
1Employee NumberMatch
2115282079706
311649
411529
511525
61000407
7207970
8207972
9207975
10208114
1111651
12208022
13208044
Mixed Values
Cell Formulas
RangeFormula
D2D2=MATCH(C2&"",$A$2:$A$14&"",0)
 
Upvote 0
Im actually doing the xlookup.
Same concept :)

22 09 25.xlsm
ABCD
1Employee NumberMatch
211528Hris207970Admin
311649SFSupport
411529Security
511525ITHELP
61000407Anindita
7207970Admin
8207972Comp
9207975EC
10208114ExtensionServiceUser
1111651Abhishek
12208022PMGM
13208044PS
1425185sf
Mixed Values
Cell Formulas
RangeFormula
D2D2=XLOOKUP(C2&"",$A$2:$A$14&"",$B$2:$B$14)
 
Upvote 0
Solution
Same concept :)

22 09 25.xlsm
ABCD
1Employee NumberMatch
211528Hris207970Admin
311649SFSupport
411529Security
511525ITHELP
61000407Anindita
7207970Admin
8207972Comp
9207975EC
10208114ExtensionServiceUser
1111651Abhishek
12208022PMGM
13208044PS
1425185sf
Mixed Values
Cell Formulas
RangeFormula
D2D2=XLOOKUP(C2&"",$A$2:$A$14&"",$B$2:$B$14)
Thank you...that works perfect
 
Upvote 0
You're welcome. Thanks for the confirmation.
 
Upvote 0
Hi All

Thanks very much Peter for your solution. How can I do the same but remove leading zeros from numbers in column A if there are any

Joe
 
Upvote 0
Hi All

Thanks very much Peter for your solution. How can I do the same but remove leading zeros from numbers in column A if there are any

Joe
Looks like a bit of a different question. I suggest that you start a new thread to ask. Also best if you provide some varied sample data and the expected results with XL2BB in the new thread. You can put a link to this thread as background it you want.
 
Upvote 0
Hi All

Thanks very much Peter for your solution. How can I do the same but remove leading zeros from numbers in column A if there are any

Joe
Apologies . . . To be clear . . . . Do the same but take into account any leading Zeros in column A . . . I will Start a new thread
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,955
Latest member
BatCoder

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