Forum Discussion
conditional formatting based on content of another cell
- Apr 13, 2021
Select the cells that you want to format conditionally. If more than one, the top left cell should be the active cell in the selection. Note the address of this cell.
On the Home tab of the ribbon. select Conditional Formatting > New Rule...
Select 'Use a formula to determine which cells to format'.
Enter a formula that evaluates to TRUE (or a non-zero number) if the rule should be applied, and to FALSE (or 0) otherwise.
In your example, let's say A2 is the active cell in the selection.
Use the following formula:
=B2<>""
Click Format...
Activate the Fill tab.
Specify the desired color (green in your example).
Click OK, then click OK again.
HansVogelaar Hello. I want to apply conditional formatting to cells in one column based on dates in another column. In this case the date format is 2024-01-01. I have entered the formula =ad28=2024-01-01 to a cell where this is True and nothing happens. The formula looks the same to me as your example =B2<>" so why is it not working? Thank you.
In your formula, Excel treats 2024-01-01 as a subtraction resulting in 2022.
For a date, use the DATE function: DATE(2024, 1, 1):
=AD28=DATE(2024, 1, 1)
Or enter the date 2024-01-01 in a cell, for example in Z1. You can then use
=AD28=$Z$1