Determine if name in list A has perfect match, partial match, or is not found in list B?

前端 未结 2 407
离开以前
离开以前 2021-01-03 15:25

In Excel, I have two columns of property names. I need to determine if a name in Column A has a complete match, a partial match or no match in Column B.

Something

2条回答
  •  春和景丽
    2021-01-03 15:41

    Exact match

    Finding out if an exact match is available is easy - you can use the MATCHfunction for this:

    =MATCH(B1,A:A,0)
    

    will return you the row number in which B1 is found. Combine it with IFERROR to handle elements that do not have any match:

    =IFERROR(MATCH(B1,A:A,0),"No exact match")
    

    Alternatively, if you're only interested if there is a match, but not where, use the ISERROR function:

    =NOT(ISERROR(MATCH(B1,A:A,0)))
    

    Partial match

    From your comment I understand that a "partial match" means the occurrence of the full string in column B as a substring in column A. You can use the SEARCHfunction for that. However, as search will only check the appearing in one cell, you need to combine it as an array formula:

    =MATCH(FALSE,ISERROR(SEARCH(B1,A1:A100)),0)
    

    Enter it with Ctrl-Shift-Enter.

    Also note that for performance reasons it is better to limit the range to search, i.e. instead of A:A, use A1:A100 - or whatever your number of rows is.

提交回复
热议问题