Lookup up Comma and non Comma separated values

rambojr

New Member
Joined
Nov 30, 2007
Messages
13
Hi I am trying to lookup numbers in multiple worksheets that have comma separated and non comma separated values. I have used the formula below but it only works in cells that have conman separated values.

=IFERROR(VLOOKUP(B$1,'Data Sheet'!$A$1:$B$3,2,FALSE),IFERROR(VLOOKUP(B$1,'Data Sheet2'!$A$1:$B$2,2,FALSE),""))

The result of the formula above is "RED" if I try to find code 8 it does not return a result, is there a way to to update the query to search for comma and non comma separated values.


Lookup Sheet
AB
1Code456

Data Sheet
AB
1123,456,789RED
28BLUE
3752,451YELLOW

Data Sheet2
AB
1652,458,752ORANGE
24GREEN
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Is the data as texts inside the cell?

123,456,789
8
752,451
 
Upvote 0
But that number how it looks, as text or as a number.

1591902481257.png


1591902575812.png

________________________________________________________________________-

By the way, the formula does not look for 456 inside the cell, I do not understand how the RED color returns to you.

varios 11jun2020.xlsm
BC
1456#N/A
Lookup Sheet
Cell Formulas
RangeFormula
C1C1=VLOOKUP(B1,'Data Sheet'!A1:B3,2,0)
 
Upvote 0
IT shows as text

the numbers in the data sheet have a space after the comma line 123, 456, 789
 
Upvote 0
Sorry I pasted the wrong formula it should be =IFERROR(VLOOKUP("*"&B$1&"*",'Data Sheet'!$A$1:$B$2,2,FALSE),IFERROR(VLOOKUP("*"&B$1&"*",'Data Sheet2'!$A$1:$B$3,2,FALSE),"nothing found"))
 
Upvote 0
Is an array formula

Dante Amor
BC
1451YELLOW
Lookup Sheet
Cell Formulas
RangeFormula
C1C1=TRIM(SUBSTITUTE(IFERROR(VLOOKUP("*, "&B1&",*",", "&'Data Sheet'!A1:B3&",",2,0),IFERROR(VLOOKUP("*, "&B1&",*",", "&'Data Sheet2'!A1:B3&",",2,0),"nothing found")),",",""))
Press CTRL+SHIFT+ENTER to enter array formulas.

Dante Amor
AB
1123, 456, 789RED
28BLUE
3752, 451YELLOW
Data Sheet

Dante Amor
AB
1652, 458, 752ORANGE
24GREEN
Data Sheet2
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,427
Members
448,961
Latest member
nzskater

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