Forum Discussion

AkiraYama's avatar
AkiraYama
Copper Contributor
Mar 07, 2022
Solved

Excel - Comparing the first 19 letters of strings in cell to see if they match

I am trying to create an evaluation cell that says something akin to true or false if the first 19 characters of the value of the cell are equal. For context, The values are directory paths, for argu...
  • OliverScheurich's avatar
    OliverScheurich
    Mar 08, 2022

    AkiraYama 

    =SUMPRODUCT(--(LEFT(B2:E2,19)=$F$1))=COUNTA(B2:E2)

    Maybe with this formula that can easily be adapted to e.g. 17 columns.

     

    The formula compares the count of cells where the left 19 characters are " C:\Directory1\abcd\  " with the number of cells that aren't empty in range B2:E2.

     

    In addition you can apply conditional formatting to highlight cells if the left 19 characters aren't " C:\Directory1\abcd\  " which is the value in cell F1 in this example.

Resources