Excel – If an Excel row contains particular words, return that row, highlight that row, or give Y/N for that row

findmicrosoft excelworksheet-function

I have a sheet containing thousands of cells in a column. These cell contains names of different securities.

Some names of these securities contains a particular string such as "C/O".

How can I use a formula that will return the rows that have these characters?

S&P 500 C/O 30/03/12 1380  
MICROSOFT C/O 19/05/12 32  
QUICKSILVER C/O 17/03/12 9

There is no consistency (can't use left/right/mid formula).

Requirement : I want the formula which will return "C/O" in the other cell if this particular cell contains it.

Best Answer

Use conditional formatting option Use a formula to determine which cells to format with the following formula:


Whenever your cell has C/O in it, it will return a value greater than 0, and you can have any formating applied (e.g. change fill color). When C/O is not present, it will remain formatted normally.

Conditional Find 2

Conditional Find

The FIND function looks for C/O and returns it starting point, which is 1 or greater. If C/O is not present it returns a #Value error. So, this uses IFERROR to return 0 for all error conditions (i.e. when C/O is not present).

EDIT: Using a reference cell for your search text (i.e. C/O in cell C1) will allow you to change your search string and highlight other cells based upon that. Note in the conditional formating window, you'll need to use an absolute reference to make sure that regardless of the evaluated cell, it always looks to $C$1. For example, you can have it find S&P:

enter image description here

Related Question