2

I have a list of names for which I want to know if there's a cross match in family name. SEE EXAMPLE So if all in Family column contain family name (as the one in col B) - there'd be a Match, otherwise not. I started by cleaning/splitting the names

=TRANSPOSE(ARRAYFORMULA(TRIM( SPLIT(SUBSTITUTE($A2," and",","),","))))

then doing a T/F match of only the family name for each case

=ISNUMBER(MATCH(REGEXEXTRACT($B$2,"\w+$"),REGEXEXTRACT(D2,"\w+$"),0))

I wanted to do this MATCH as an array, but it's not working. And then I'd have to do a count of the TRUE value if all are TRUE return a MATCH, else NO MATCH. I obviously want to do this in a single cell, but got stuck because I can't make the MATCH an array. I hope that makes sense, or am I going about this the wrong way. Here's the sample sheet

2
  • why is Andy Scott NO MATCH? Commented Oct 12, 2021 at 16:55
  • because I just want to know which are the ones for which all members have fam. names. For Scott only Noah Scott is a match - so I guess I could fine tune it to show one match or smth., if there is just one but at this point I just wanna know if all are match . I'm using col. B Name just as reference for the fam. name. Commented Oct 12, 2021 at 16:59

3 Answers 3

1

try:

=ARRAYFORMULA(IF(A2:A="",,IF(1+LEN(
 REGEXREPLACE(SUBSTITUTE(A2:A, "and", ","), "[^,]", ))=
 MMULT(N(IFERROR(IF(SPLIT(SUBSTITUTE(A2:A, "and", ","), ",")="",,
 REGEXMATCH(TRIM(SPLIT(SUBSTITUTE(A2:A, "and", ","), ",")), 
 REGEXEXTRACT(B2:B, "\w+$"))))), 
 SEQUENCE(COLUMNS(SPLIT(SUBSTITUTE(A2:A, "and", ","), ",")), 1, 1, 0)), 
 "match", "no match")))

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Sand family looks at you with confusion. :)
0

use this

C2=trim(index(split(B2," "),1,COUNTA(split(B2," "))))

D2=SUBSTITUTE(A2,"and",",")

E2=if(COUNTA(split(D2,C2,false))=counta(split(D2,",",false)),"matched","not matched")

1- C2 gets the last word from sentence as last name

2- D2 Replaces "and" by ","

3- E2 splits D2 by "," and splits D2 by C2 then counts and compares if same means all matched

Result

enter image description here

Comments

0

another one for you:

=ARRAYFORMULA(
  IFS(
    A2:A = "",,
    ISNA(MATCH(
      ROW(A2:A),
      QUERY(
        QUERY(
          SPLIT(
            FLATTEN(
              FILTER(
                  ROW(A2:A) & "♥"
                & --NOT(REGEXMATCH(
                      SPLIT(
                        REGEXREPLACE(A2:A, ",\s*|\s+and\s+", "♥"),
                        "♥"
                      ),
                      "^$|" & REGEXEXTRACT(B2:B, "\s(\w+)$")
                    )),
                A2:A <> ""
              )
            ),
            "♥"
          ),
          "SELECT Col1, SUM(Col2)
           GROUP BY Col1",
        ),
        "SELECT Col1
         WHERE Col2 = 0",
      ),
    )),
      "NO MATCH",
    True,
      "MATCH"
  )
)

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.