If you want to highlight rows in a table that contain specific text, you use conditional formatting with a formula that returns TRUE when the the text is found. The trick is to concatenate (glue together) the columns you want to search and to lock the column references so that only the rows can change.
For example, assume you have a simple table of data in B4:E11 and you want to highlight all rows that contain the text "dog". Just select all data in the table and create a new conditional formatting rule that uses this formula:
Note: with conditional formatting, it's important that the formula be entered relative to the "active cell" in the selection, which is assumed to be B4 in this case.
The SEARCH function returns the position of the text you are looking for as a number (if it exists). Conditional formatting automatically treats any positive number as TRUE, so the rule is triggered whenever search returns a number. When SEARCH doesn't find the text you're looking for, it returns a #VALUE error, which conditional formatting treats as FALSE.
Using the ampersand (&) we are concatenating all values in each row together and then searching the result with SEARCH. All addresses are entered in "mixed" format, with the columns locked and the rows left relative. Effectively, this means that all 4 cells in each row are tested with exactly the same formula.
Using other cells as inputs
Note that you don't have to hard-code any values that might change into the rule. Instead you can use another cell as an "input" cell so you can easily change it later. For example, in this case, you could name cell E2 "input" and rewrite the formula like so
When you use a formula to apply conditional formatting, the formula is evaluated relative to the active cell in the selection at the time the rule is created. In this case, the address of the active cell (B5) is used for the row (5) and entered as a...
The Excel SEARCH function returns the location of one text string inside another. SEARCH returns the position of the first character of find_text inside within_text. Unlike FIND, SEARCH allows wildcards, and is not case-sensitive.
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.