Matching codes between two columns

smalik

Board Regular
Joined
Oct 26, 2006
Messages
180
Office Version
  1. 365
Platform
  1. Windows
I have a number of codes in two columns A & B as shown below:

I am trying to find out which codes from Column B are not in columns A.

Column A has only one code per cell. However, certain cells in Column B has multiple codes separated by a ","
There are 500 rows in Column A so this means I have 500 codes in Column A. Column B has 850+ rows but certain rows has more than one code so there could be well over 1,000 codes

I was thinking about using Text to Column feature in Column B and then do a lookup but is there a formula I can use to identify the missing codes without going through that exercise.

Any help is greatly appreciate.

1615490826519.png
 

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
Can you post some sample date.
Also do you have the LET function?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Maybe this bit will be useful here...
MrExcelPlayground.xlsm
ABCDE
2ABB converted to one listIn B but not in AOr
3abb, e, f, i, l, p, g, a, k, i, m, n, o, p, s, v, yg, k, o, s, v, y 
4be, fg
5cik
6dl, po
7egs
8fa, kv
9hiy
10im, n
11jo, p
12ls
13mv, y
14n
15p
16q
17r
18t
19u
20w
21x
22z
Sheet31
Cell Formulas
RangeFormula
C3C3=TEXTJOIN(", ",TRUE,B3:B13)
D3D3=TEXTJOIN(", ",TRUE,IF(ISNA(MATCH(UNIQUE(TRIM(MID(SUBSTITUTE(C3,", ",REPT(" ",99)),IF(SEQUENCE(LEN(C3)-LEN(SUBSTITUTE(C3,", ",""))+1)=1,1,(SEQUENCE(LEN(C3)-LEN(SUBSTITUTE(C3,", ",""))+1)-1)*99),99))),A3:A22,0)),UNIQUE(TRIM(MID(SUBSTITUTE(C3,", ",REPT(" ",99)),IF(SEQUENCE(LEN(C3)-LEN(SUBSTITUTE(C3,", ",""))+1)=1,1,(SEQUENCE(LEN(C3)-LEN(SUBSTITUTE(C3,", ",""))+1)-1)*99),99))),""))
E3:E9E3=UNIQUE(IF(ISNA(MATCH(UNIQUE(TRIM(MID(SUBSTITUTE(C3,", ",REPT(" ",99)),IF(SEQUENCE(LEN(C3)-LEN(SUBSTITUTE(C3,", ",""))+1)=1,1,(SEQUENCE(LEN(C3)-LEN(SUBSTITUTE(C3,", ",""))+1)-1)*99),99))),A3:A22,0)),UNIQUE(TRIM(MID(SUBSTITUTE(C3,", ",REPT(" ",99)),IF(SEQUENCE(LEN(C3)-LEN(SUBSTITUTE(C3,", ",""))+1)=1,1,(SEQUENCE(LEN(C3)-LEN(SUBSTITUTE(C3,", ",""))+1)-1)*99),99))),""))
Dynamic array formulas.
 
Upvote 0
@JamesCanale That will almost certainly fail with the strings that the OP has, due to the varying lengths of them.
 
Upvote 0
I know it is complicated. Some of these strings are way too long. I noticed it when <CTRL F> did not work for some of these big strings.

I got it done using the Text to Column function plus Trim function plus a little bit of manual work. It was tedious but it worked.

Thanks to JamesCanale & Fluff for looking into this request. It was much appreciated.

 
Upvote 0
Solution
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,692
Messages
6,126,226
Members
449,303
Latest member
grantrob

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