Using Vlookup for Alphanumeric and numeric values. It is not recognising the numeric

davids4500

Board Regular
Joined
Jan 14, 2023
Messages
61
Office Version
  1. 365
Platform
  1. Windows
I am using vlookup in excel 365. Column A is where the product number is scanned and can be alpha numeric or numeric.
Excel finds the matches for the alpha numeric but not the numeric.
Column A where the barcodes are scanned is formatted General.
The columns on the data sheet for the alpha numeric are formatted general and the numeric is number.
How do I get the scanned numeric barcode to successfully interpret the value in the data column in the data sheet.

SamplesScansheetC&S.xlsx
ABC
1Scan Code HereProduct CodeProduct Name
2CCH000084CCH000084Air Freshener I Brake For Turtles
3CCH000085CCH000085Air Freshener Bouquet
4AFR205AFR205Air Freshener Pink Heart - Strawberry
56.14391E+11  
66.14391E+11  
76.14391E+11  
86.14391E+11  
9
ScanSheet
Cell Formulas
RangeFormula
B2:B8B2=IFERROR(VLOOKUP(A2,data!A:C,COLUMN(A2)*1,FALSE), "")
C2:C8C2=IFERROR(VLOOKUP($A2,data!A:D,COLUMN(D2)*1,FALSE), "")
Named Ranges
NameRefers ToCells
data!samplestoday=data!$A$1:$R$809B2:C8
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A67:A68,A5:A8Cell Valuecontains "Sample"textNO


SamplesScansheetC&S.xlsx
ABCD
1Item CodeSUPPLIER CODEITEMCODE2NAME
2AFR021AFR021614390300994Air Freshener Free To Fly
3AFR037AFR037614390308983Air Freshener Friends Fill
4AFR065AFR065614390341799Air Freshener Truck Don't Look Back (Ocean)
5AFR157AFR157614390545050Air Freshener Beautiful Girl - Strawberry
6AFR158AFR158614390545043Air Freshener Stay Classy
7AFR159AFR159614390545012Air Freshener A Wise Girl Once Said
8AFR172AFR172614390557077Air Freshener Make Difference Today
9AFR176AFR176614390557114Air Freshener I Heart My Dog
10AFR180AFR180614390561609Air Freshener AICIS NOT APPROVED Let's Just Go
11AFR191AFR191614390585605Air Freshener Stay Close
12AFR192AFR192614390585612Air Freshener Sometimes
13AFR205AFR205614390614985Air Freshener Pink Heart - Strawberry
14AFR208AFR208614390615012Air Freshener Kindness Matters
15AFR209AFR209614390615029Air Freshener Be Happy Van Orange
16AFR213AFR213614390642520Air Freshener Always Remember
17AFR219AFR219614390642575Air Freshener Mushroom
18AFR220AFR220614390642582Air Freshener Butterfly - Ocean
data
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C:CCell Valuecontains "Sample"textNO
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi David,

The problem is not the vlookup, but the way you use it. COLUMN(A2) will return 1, so your function return the cell value where it finds it. If you look for CCH000084, it will return the same cell which contain CCH000084. For the number, I would put an iferror in an iferror like so:

Excel Formula:
=IFERROR(VLOOKUP(A2,data!$A:$D,4,FALSE), IFERROR(VLOOKUP(A2,data!$C:$D,2,FALSE), ""))

Bests regards,

Vincent
 
Upvote 0
Thank you so much. Very good
=IFERROR(VLOOKUP(A2,data!$A:$D,1,FALSE), IFERROR(VLOOKUP(A2,data!$C:$D,2,FALSE), ""))
I have changed the formula(1) so that the first part returns column A from the data worksheet. How do i accomplish that Returns the data in Column A), with the second part of the formula?
I am so very thankful
David
 
Upvote 0
Thank you so much. Very good
=IFERROR(VLOOKUP(A2,data!$A:$D,1,FALSE), IFERROR(VLOOKUP(A2,data!$C:$D,2,FALSE), ""))
I have changed the formula(1) so that the first part returns column A from the data worksheet. How do i accomplish that Returns the data in Column A), with the second part of the formula?
I am so very thankful
David
Hi david,

Now I think I understand, in any way, you want to get the value of the first column. Here's for Product Code
Excel Formula:
=IFERROR(VLOOKUP($A2,data!$A:$A,1,FALSE), IFERROR(XLOOKUP($A2,data!$C:$C,data!$A:$A,"",0), ""))

For Product Name
Excel Formula:
=IFERROR(VLOOKUP($B2,data!$A:$D,4,FALSE),"")

Bests regards,

Vincent
 
Upvote 0
Dear Vincent
Thank you for taking the time.
Much appreciated and very much helpful... very good result
Kindest regards David
 
Upvote 0
A couple of short alternatives you could also try if you want
Excel Formula:
=LET(a,data!A:A,XLOOKUP(A2,a,a,XLOOKUP(A2,data!C:C,a,"")))
Excel Formula:
=XLOOKUP(B2,data!A:A,data!D:D,"")
 
Upvote 0
Dear Vincent
Thank you for taking the time.
Much appreciated and very much helpful... very good result
Kindest regards David
Hi Vincent. I have found one anomaly that if there is no code column A (Scan sheet) then it displays the first product where there is no code in column C on the data sheet

SamplesScansheetC&S.xlsx
ABCD
577MUG000068MUG000068614390683912Camp Mug Mountains
578MUG000069MUG000069614390683929Camp Mug Mushroom
579MUG000072MUG000072614390684421Mushroom Mug with Lid Grow Own Way
580MUG000073MUG000073614390684711Favourite Mug Do More Soul Happy
581MUG000074MUG000074614390685367Rainbow Mug You Make The World Better
582MUG000075MUG000075614390686050Folk Art Mug Cream Turtle
583MUG000076MUG000076614390686067Folk Art Mug Cream Camper
584MUG000077MUG000077Artisan Rainbow Courage Mug
585MUG000078MUG000078614390692150Artisan Rainbow Gratitude Mug
586MUG000079MUG000079614390696417Latte Mug The Place Mountain Range
587MUG000080MUG000080614390696424Bungalow Mug Every Home Has A Dog
588MUG000082MUG000082614390696448Artisan Mug Good Friends Mushrooms
data
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C:CCell Valuecontains "Sample"textNO



Cell Formulas
RangeFormula
B315:B317,B319:B323B315=IFERROR(VLOOKUP($A315,data!$A:$A,1,FALSE), IFERROR(XLOOKUP($A315,data!$C:$C,data!$A:$A,"",0), ""))
C315:C323C315=IFERROR(VLOOKUP($B315,data!$A:$D,4,FALSE),"")
B318B318=IFERROR(VLOOKUP($A318,data!$A:$A,1," "), IFERROR(XLOOKUP($A318,data!$C:$C,data!$A:$A,"",0), ""))
Named Ranges
NameRefers ToCells
data!samplestoday=data!$A$1:$T$809B315:C323
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A316Cell Valuecontains "Sample"textNO
 
Upvote 0
Then what about

B2:
Excel Formula:
=IF(A2="","",LET(a,data!A:A,XLOOKUP(A2,a,a,XLOOKUP(A2,data!C:C,a,""))))

C2:
Excel Formula:
=IF(B2="","",XLOOKUP(R2,data!A:A,data!D:D,""))
 
Upvote 0
Hi Vincent. I have found one anomaly that if there is no code column A (Scan sheet) then it displays the first product where there is no code in column C on the data sheet

SamplesScansheetC&S.xlsx
ABCD
577MUG000068MUG000068614390683912Camp Mug Mountains
578MUG000069MUG000069614390683929Camp Mug Mushroom
579MUG000072MUG000072614390684421Mushroom Mug with Lid Grow Own Way
580MUG000073MUG000073614390684711Favourite Mug Do More Soul Happy
581MUG000074MUG000074614390685367Rainbow Mug You Make The World Better
582MUG000075MUG000075614390686050Folk Art Mug Cream Turtle
583MUG000076MUG000076614390686067Folk Art Mug Cream Camper
584MUG000077MUG000077Artisan Rainbow Courage Mug
585MUG000078MUG000078614390692150Artisan Rainbow Gratitude Mug
586MUG000079MUG000079614390696417Latte Mug The Place Mountain Range
587MUG000080MUG000080614390696424Bungalow Mug Every Home Has A Dog
588MUG000082MUG000082614390696448Artisan Mug Good Friends Mushrooms
data
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C:CCell Valuecontains "Sample"textNO



Cell Formulas
RangeFormula
B315:B317,B319:B323B315=IFERROR(VLOOKUP($A315,data!$A:$A,1,FALSE), IFERROR(XLOOKUP($A315,data!$C:$C,data!$A:$A,"",0), ""))
C315:C323C315=IFERROR(VLOOKUP($B315,data!$A:$D,4,FALSE),"")
B318B318=IFERROR(VLOOKUP($A318,data!$A:$A,1," "), IFERROR(XLOOKUP($A318,data!$C:$C,data!$A:$A,"",0), ""))
Named Ranges
NameRefers ToCells
data!samplestoday=data!$A$1:$T$809B315:C323
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A316Cell Valuecontains "Sample"textNO
Hi David,

The answer from Peter would suit your case. Although, if you want to keep the formulas I've made, here's how to prevent that error:

For Product Code
Excel Formula:
=IF($A2 = ""; ""; IFERROR(VLOOKUP($A2,data!$A:$A,1,FALSE), IFERROR(XLOOKUP($A2,data!$C:$C,data!$A:$A,"",0), "")))

For Product Name
Excel Formula:
=IF($A2="";"";IFERROR(VLOOKUP($B2,data!$A:$D,4,FALSE),""))

Bests regards,

Vincent
 
Upvote 0

Forum statistics

Threads
1,225,897
Messages
6,187,711
Members
453,435
Latest member
U4US

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