Forum Discussion

Tolley123's avatar
Tolley123
Copper Contributor
Apr 23, 2023
Solved

Cell to Range Compare with Text String Output

Hi, request for help please.

I need a formula that will compare the entry in a cell (A1) to the entries in a defined range (A2:A101), and if there is a match with any cell in the defined range provide a text string, otherwise an alternate text string.

Thanks in advance.

  • Tolley123 

    =IF(SUM(N(ISNUMBER(SEARCH(A1,A2:A6))))>0,"yes","no")

    You can try this formula. Enter the formula with ctrl+shift+enter if you don't work with Office 365 or Excel 2021.

6 Replies

  • Tolley123 

    If you want to know if any of the cells A2:A101 is equal to A1:

    =IF(ISNUMBER(MATCH(A1, A2:A101, 0)), "Some Text", "Other Text")

    If you want to know if any of the cells A2:A101 contains the value of A1, possibly together with other text:

    =IF(ISNUMBER(MATCH("*"&A1&"*", A2:A101, 0)), "Some Text", "Other Text")

    • Tolley123's avatar
      Tolley123
      Copper Contributor
      Hans, that works well. Thank you. Unfortunately following further testing QPs answer did not work 😕
      • OliverScheurich's avatar
        OliverScheurich
        Gold Contributor

        Tolley123 

        My reply is still marked as best response although the formula didn't work in your further testing. Can you give an example for which the formula doesn't work? Maybe i didn't correctly understand what you want to do. 

  • Tolley123 

    =IF(SUM(N(ISNUMBER(SEARCH(A1,A2:A6))))>0,"yes","no")

    You can try this formula. Enter the formula with ctrl+shift+enter if you don't work with Office 365 or Excel 2021.

Resources