Compare cell contents against string in Excel

133,950

Solution 1

You can use the EXACT Function for exact string comparisons.

=IF(EXACT(A1, "ENG"), 1, 0)

Solution 2

If a case-insensitive comparison is acceptable, just use =:

=IF(A1="ENG",1,0)
Share:
133,950
Pr0no
Author by

Pr0no

Updated on July 23, 2022

Comments

  • Pr0no
    Pr0no almost 2 years

    Consider the following:

        A   B
    1  ENG  1
    2  ENG  1
    3  FRA  0
    4  FOO  0
    

    I need a formula to populate the B column with 1 if the A column contains the string ENG, or 0 otherwise.

    I've tried (in cell B1) =IF(A1=(TEXT(ENG;FALSE));1;0) but then it says #NAME? in the cell. Putting ENG between quotation marks doesn't help either. What should my formula be like?