Forum Discussion
zchahin
Jul 27, 2024Copper Contributor
Comparing two columns with comma separated string values (match)
Hi, I currently have two columns of reference data. Each cell contains comma separated values. My aim is to find a match between any of the patent numbers in column A within the corresponding ...
- Jul 06, 2021
Another mockup with lambdas
prefix = {"No", "No:"}; removeFirst = lambda(str, txt, SUBSTITUTE(str, txt, "",1) ); //// noPrefix = lambda(str, k, IF(k=0, TRIM(str), LET(t, removeFirst(str, INDEX(prefix,1,k)), noPrefix(t, k-1) ) )); cleanText = lambda(str, noPrefix(str, COLUMNS(prefix))); nFirstSpace = lambda( str, FIND(" ", str)-1); textStart = lambda(str, n, TRIM(LEFT(str, n))); textEnd = lambda(str, n, TRIM(RIGHT(str, LEN(str)-n))); lastPos = lambda(str, chr, n, IF(RIGHT(str)=chr, n, lastPos(LEFT(str, n-1), chr, n-1))); posRightSpace = lambda(str, lastPos(str, " ", LEN(str))); //// splitParts = lambda( str, LET( txt, cleanText(str), nA, nFirstSpace(txt), partA, textStart(txt, nA), partBC, textEnd(txt, nA), first40, textStart(partBC, 40), space40, posRightSpace(first40), partB, IF(LEN(partBC)<=40, partBC, textStart(partBC, space40) ), partC, IF(LEN(partBC)<=40, "", textEnd(partBC, space40) ), IFERROR(CHOOSE({1,2,3}, partA, partB, partC),"") ) );
HansVogelaar
Jul 27, 2024MVP
- zchahinAug 25, 2024Copper ContributorHi,
Just a follow-up question to this.
I was wondering if the output in cell C2 instead of showing Match, could in fact show the matching citation itself.
E.g. in row 2, there is a match between value in column 1 (CN117860385A) and column 2. In column C, the output would be the matching citation: CN117860385A as opposed to "Match".
many many thanks- HansVogelaarAug 25, 2024MVP
How about
=LET(a, TEXTSPLIT(A2, "|"), b, TEXTSPLIT(B2, "|"), IFERROR(FILTER(a, ISNUMBER(XMATCH(a, b))), ""))
- zchahinAug 26, 2024Copper Contributor
Brilliant, thank you very much for your help.
I have one final question to seek support on.
Is it possible to have a formula in column F which is able to identify if the values in column E (matching citations) are present in column A (original patents). If so, they output the term "Delete" in the corresponding row in column F. An e.g. would be in column E US1111 is a matching citation. The formula would search column A for US1111 (A28) and if present would output Delete in column F (F28 in the example below).
- zchahinJul 27, 2024Copper Contributor