Home » excel » Using Excel "IF" Statment To Filter Out Text Beginning Or Ending With A Certain Character

Using Excel "IF" Statment To Filter Out Text Beginning Or Ending With A Certain Character

Posted by: admin March 9, 2020 Leave a comment


Working on the same project as before and I need to find a way to to write an “IF” statement that will search for words beginning with a “<” as well as words that end with a ” \ “. I would like to conditionally highlight those cells with the value “IGNORE: HIDDEN FIELD”.

I searched around and found that there is a SEARCH function in Excel but that doesn’t seem to be what I’m looking for.

Is anyone aware of how to do this? “If a cell begins with a “<” or ends with a ” \ ” then blah blah blah”.

How to&Answers:

To match words that start with < and end with \, use


To match words that start with < and / or end with \, use


Cell A1 contains the word to test. This can form the basis of your conditional formatting test. If you want to display alternative text then replace TRUE and FALSE to suit personal taste, e.g. IGNORE: HIDDEN FIELD and A1 respectively.



=IF(OR(LEFT(A1)={"<","\"}),"blah-blah-blah", "")

That formula covers cell values beginning with either a less than or backslash. If the backslash should be checked at the end of the cell value then this would be more appropriate.

=IF(OR(LEFT(A1)="<",RIGHT(A1)="\"),"blah-blah-blah", "")

The LEFT() and RIGHT() functions default to a single character so if only the first character from either direction is to be examined the num_chars parameter is not required.


Looks like you can use SEARCH()

=IF(OR(SEARCH("\";A1;1)=LEN(A1);SEARCH("<";A1;1)=1); "blahblahblah";"blahblahblah")


You could do the same job without IF

Replace function (CTRL+F) and “*” operator.

Press CTRL+F

Type “<*” to look for values that cells witch content begins with<
Than replace for whatever you want.

Type “*/” to find cells that’s values end with /
Than replace it for whatever you want.

Or even better you could use Conditional Formating, it has one option for highlighting the cells that begins with a certain character.