Comparing (comma seperated) string values between two columns

mchina1

New Member
Joined
Aug 25, 2024
Messages
5
Office Version
  1. 2021
Platform
  1. MacOS
Hi! and thank you in advance

Is there a way to achieve the following below which is related to a problem I have found when reviewing citation data:

Essentially, I want to find the matching citation/string value between column B and column C. So, between B2 and C2 this would be US1111. Ideally, my output in D2 would be B2 minus US1111. So, overall my intention is to identify if there is a matching citation in both B and C. If there is, the output in column D is all the unique string values in B minus the identified matching citation (between col B and C). If there is no matching citation between column B and C, then the output in column D is essentially identical to column B (as there are no matching citations to remove).

Have inputed some desired output in column D below.
E.g. Row 2: B2 and C2 have a matching citation (US1111). Output D2: all the citations in B2 but removed US1111

Row 3: B3 and C3 have a matching citation (US1012). Output D3: all the citations in B3 but removed US1012

Row 4: B4 and C4 have no matching citations. Output D4: essentially all the same values in B4 as no citation to remove.

zchahin.xlsx
ABCD
1Patent NumberBackward CitationsForward CitationsBackward citations minus match
2US1000US435 | US756 | US2305 | US1111JP233 | EN435| US1111US435 | US756 | US2305
3US1001US435 | US433 | US1012US1012US435 | US433
4US1002US878 | JP545 | EN987US777US878 | JP545 | EN987
5US1003JP233 | EN435US666
6US1004US123US555
7US1005US1111 | US1018JP254 | US435| US1018
8US1006US4777 | EN768 | JP747EN747 | US377
9US1007US4777 | EU23331 | US233JP5444
10US1008EP0239409A1|EP0291292A2|EP0595291A1|FR2845889A1EP1255403A2|EP1632181A1|FR2845889A1
Sheet1
 
If you're able to use these functions, then perhaps this:
Book1
ABCDEF
1Patent NumberBackward CitationsForward CitationsBackward citations minus matchFormula
2US1000US435 | US756 | US2305 | US1111JP233 | EN435| US1111US435 | US756 | US2305US435 | US756 | US2305
3US1001US435 | US433 | US1012US1012US435 | US433US435 | US433
4US1002US878 | JP545 | EN987US777US878 | JP545 | EN987US878 | JP545 | EN987
5US1003JP233 | EN435US666JP233 | EN435
6US1004US123US555US123
7US1005US1111 | US1018JP254 | US435| US1018US1111
8US1006US4777 | EN768 | JP747EN747 | US377US4777 | EN768 | JP747
9US1007US4777 | EU23331 | US233JP5444US4777 | EU23331 | US233
10US1008EP0239409A1|EP0291292A2|EP0595291A1|FR2845889A1EP1255403A2|EP1632181A1|FR2845889A1EP0239409A1|EP0291292A2|EP0595291A1
Sheet8
Cell Formulas
RangeFormula
F2:F10F2=LET(s,TAKE(BYCOL(TRIM(TEXTSPLIT(B2,"|")),LAMBDA(c,IF(ISNUMBER(SEARCH(c,C2)),SUBSTITUTE(B2,c,""),B2))),1,-1),TRIM(TEXTBEFORE(TRIM(s)&"@","|@",,,,s)))

Brilliant - works perfectly and thank you very much for your help!
 
Upvote 0

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,)
HI, here's another way to do it if interested (assuming XL365 is being used).

Book1
ABCD
1Patent NumberBackward CitationsForward CitationsBackward citations minus match
2US1000US435 | US756 | US2305 | US1111JP233 | EN435| US1111US435 | US756 | US2305
3US1001US435 | US433 | US1012US1012US435 | US433
4US1002US878 | JP545 | EN987US777US878 | JP545 | EN987
5US1003JP233 | EN435US666JP233 | EN435
6US1004US123US555US123
7US1005US1111 | US1018JP254 | US435| US1018US1111
8US1006US4777 | EN768 | JP747EN747 | US377US4777 | EN768 | JP747
9US1007US4777 | EU23331 | US233JP5444US4777 | EU23331 | US233
10US1008EP0239409A1|EP0291292A2|EP0595291A1|FR2845889A1EP1255403A2|EP1632181A1|FR2845889A1EP0239409A1 | EP0291292A2 | EP0595291A1
Sheet1
Cell Formulas
RangeFormula
D2:D10D2=LET(TS,TRIM(TEXTSPLIT(B2,"|")),TEXTJOIN(" | ",1,FILTER(TS,ISNA(MATCH(TS,TRIM(TEXTSPLIT(C2,"|")),0)))))
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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