You can use the custom formula function in Google Sheets to apply conditional formatting to a cell if another cell is not empty.
The following example shows how to use the custom formula function in practice.
Example: Conditional Formatting if Another Cell Contains Text in Google Sheets
Suppose we have the following dataset in Google Sheets that contains information about various basketball players:
Suppose we’d like to highlight each of the cells in the Team column if the cell in the corresponding Rating column is not empty.
To do so, we can highlight the cells in the range A2:A11, then click the Format tab, then click Conditional formatting:
In the Conditional format rules panel that appears on the right side of the screen, click the Format cells if dropdown, then choose Custom formula is, then type in the following formula:
=NOT(ISBLANK(C2))
Note: It’s important that you include the equal sign (=) at the beginning of the formula, otherwise the conditional formatting won’t work.
Once you click Done, each of the cells in the Team column where the corresponding value in the Rating column is not empty will be highlighted with a green background:
We can see that the only Team values that have a green background are the ones where the corresponding value in the Rating column are not empty.
Note that you can also apply a different background color to the cells in the Team column by specifying a different color within the Conditional format rules panel.
Additional Resources
The following tutorials explain how to perform other common tasks in Google Sheets:
Google Sheets: Conditional Formatting If Date is Before Today
Google Sheets: Conditional Formatting with Multiple Conditions
Google Sheets: Conditional Formatting if Another Cell Contains Text