Comparing two comma-delimited lists and getting unique values

edrickz101

New Member
Joined
Sep 20, 2022
Messages
6
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello!

A set of data was gathered where it consists of name of certifications and those who have completed such certifications. Required certifications (certs to shorten) needs to have a 'Yes' filled out . What I'm trying to figure out is returning a list of what certs that are required against on what are completed.

Book1
ABCDEFGHIJKLMNO
1NameMissing ABCDEFGHIJKLRequiredCompletedNameCompletedName
2EdYesYesYesAB, CD, GHCD, AB, EFEdCDEdCD, AB, EF
3SamCD, EFEdABSamCD, EF
4JillEF, AB, GH, IJEdEFJillEF, AB, GH, IJ
5JuliaABSamCDJuliaAB
6TamGH, AB, KLSamEFTamGH, AB, KL
7TaroGH, CDJillEFTaroGH, CD
8PeteIJ, KL, CD, EFJillABPeteIJ, KL, CD, EF
9JillGH
10JillIJ
11JuliaAB
12TamGH
13TamAB
14TamKL
15TaroGH
16TaroCD
17PeteIJ
18PeteKL
19PeteCD
20PeteEF
Sheet1
Cell Formulas
RangeFormula
I2I2=TEXTJOIN(", ",TRUE,IF(C2="Yes",$C$1,""),IF(D2="Yes",$D$1,""),IF(E2="Yes",$E$1,""),IF(F2="Yes",$F$1,""),IF(G2="Yes",$G$1,""),IF(H2="Yes",$H$1,""))
J2:J8J2=VLOOKUP(A2,N:O,2,FALSE)
O2:O8O2=TEXTJOIN(", ",TRUE,IF(N2=$L$2:$L$20,$M$2:$M$20,""))
Press CTRL+SHIFT+ENTER to enter array formulas.


You can see in the table that 'Ed' has already completed AB and CD, which means GH is only required for him.

Actually I've checked other posts here sharing some solutions (Link1 & Link2). So far both of the posts have great solutions especially in Link1 where user Yongle shared a VBA code to use. Their code 'UniqDup' compared uniques from list 1 against list 2, list 2 against list 1, and uniques among the two lists. However in Yongle's code is not working well if I have duplicates in both Required and Completed columns.

Book1
ABCDEFGHIJKL
1NameMissing 1Missing 2Missing 3ABCDEFGHIJKLRequiredCompleted
2Ed AB, CD, GH YesYesYesAB, CD, GHCD, AB, EF
Sheet1
Cell Formulas
RangeFormula
B2B2=UniqDup(K2,L2,1)
C2C2=UniqDup(K2,L2,2)
D2D2=UniqDup(K2,L2)
K2K2=TEXTJOIN(", ",TRUE,IF(E2="Yes",$E$1,""),IF(F2="Yes",$F$1,""),IF(G2="Yes",$G$1,""),IF(H2="Yes",$H$1,""),IF(I2="Yes",$I$1,""),IF(J2="Yes",$J$1,""))
L2L2=VLOOKUP(A2,P:Q,2,FALSE)


Here you could see AB and CD is picked up even though they are duplicates from Required and Completed. Expected result is supposed to be GH. I tried other variations of Yongle's formula but none generated the expected result.

Here's what the Yongle's formula looks like if both are unique to each other which works well. Refer to Sam's row
Book1
ABCDEFGHIJKL
1NameMissing 1Missing 2Missing 3ABCDEFGHIJKLRequiredCompleted
2Ed AB, CD, GH YesYesYesAB, CD, GHCD, AB, EF
3Sam AB, IJ YesYesAB, IJCD, EF
Sheet1
Cell Formulas
RangeFormula
B2:B3B2=UniqDup(K2,L2,1)
C2:C3C2=UniqDup(K2,L2,2)
D2:D3D2=UniqDup(K2,L2)
K2:K3K2=TEXTJOIN(", ",TRUE,IF(E2="Yes",$E$1,""),IF(F2="Yes",$F$1,""),IF(G2="Yes",$G$1,""),IF(H2="Yes",$H$1,""),IF(I2="Yes",$I$1,""),IF(J2="Yes",$J$1,""))
L2:L3L2=VLOOKUP(A2,P:Q,2,FALSE)


To sum it up:
- 2 columns (Required vs Completed) where information is delimited by commas needs to be compared.
- Result of such comparison needs to be unique value/s from the Required column and must not contain any value from the Completed.
- Tried a VBA code writted by Yongle from this post but the code isn't working well if there are duplicate values inside the two lists.

Let me know if there are any unclarities in my question.

Thank you in advance
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi & welcome to MrExcel.
Is this what you want
Fluff.xlsm
ABCDEFGHIJKLM
1NameMissing ABCDEFGHIJKLRequiredCompletedNameCompleted
2EdYesYesYesGHCD, AB, EFEdCD
3SamYesYesyesKLCD, EFEdAB
4JillEF, AB, GH, IJEdEF
5JuliaABSamCD
6TamGH, AB, KLSamEF
7TaroGH, CDJillEF
8PeteIJ, KL, CD, EFJillAB
9JillGH
10JillIJ
11JuliaAB
12TamGH
13TamAB
14TamKL
15TaroGH
16TaroCD
17PeteIJ
18PeteKL
19PeteCD
20PeteEF
Input
Cell Formulas
RangeFormula
I2:I3I2=LET(a,FILTER($C$1:$H$1,C2:H2="yes",""),TEXTJOIN(", ",,FILTER(a,ISNA(MATCH(a,FILTER($M$2:$M$20,$L$2:$L$20=A2),0)),"")))
J2:J8J2=TEXTJOIN(", ",TRUE,IF(A2=$L$2:$L$20,$M$2:$M$20,""))
 
Upvote 0
Solution
Hey Fluff! Thanks for the response.
This really looks good! I will try out it.

Also while I was checking some files that I may have downloaded from other forums, I came across a VBA code but I will first use your formula. I will do some testing and will get back to you soon
 
Upvote 0
Hi & welcome to MrExcel.
Is this what you want
Fluff.xlsm
ABCDEFGHIJKLM
1NameMissing ABCDEFGHIJKLRequiredCompletedNameCompleted
2EdYesYesYesGHCD, AB, EFEdCD
3SamYesYesyesKLCD, EFEdAB
4JillEF, AB, GH, IJEdEF
5JuliaABSamCD
6TamGH, AB, KLSamEF
7TaroGH, CDJillEF
8PeteIJ, KL, CD, EFJillAB
9JillGH
10JillIJ
11JuliaAB
12TamGH
13TamAB
14TamKL
15TaroGH
16TaroCD
17PeteIJ
18PeteKL
19PeteCD
20PeteEF
Input
Cell Formulas
RangeFormula
I2:I3I2=LET(a,FILTER($C$1:$H$1,C2:H2="yes",""),TEXTJOIN(", ",,FILTER(a,ISNA(MATCH(a,FILTER($M$2:$M$20,$L$2:$L$20=A2),0)),"")))
J2:J8J2=TEXTJOIN(", ",TRUE,IF(A2=$L$2:$L$20,$M$2:$M$20,""))

I tried implementing this in the main file that I have. Unfortunately, it's not working as intended. It's capturing that has "yes" and not removing that's already Completed. I find it strange that I tried replicating the data that I have in a fresh file and it worked well but when I tried in the main file I did not work. I tried rebuilding the main file from scratch and still it did not work :(

Troubleshooting done:
- Made sure the completed and required are using the same names

I think the formula should still work even if it's trying to referrence a lot of columns
 
Upvote 0
Check that the codes are the same & that none have any leading/trailing spaces.
 
Upvote 0
Check that the codes are the same & that none have any leading/trailing spaces.
Most definitely this is the case. I'll just rebuild the file from scratch, make data headers/lables 1:1, etc etc.

Thank you so much for the help!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

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