In the example shown, we want to mark rows where the color is red with an “x”. In other words, we want to test cells in column B, and take a specific action when they equal the word “red”. The formula in cell D6 is: In this formula, the logical test is this bit: This will return TRUE if the value in B6 is “red” and FALSE if not. Since we want to mark or flag red items, we only need to take action when the result of the test is TRUE. In this case, we are simply adding an “x” to column D if when the color is red. If the color is not red (or blank, etc.), we simply return an empty string (""), which displays as nothing. Note: if an empty string ("") is not provided for value_if_false, the formula will return FALSE when the color is not red or green.

Increase price if color is red

Of course, you could do something more complicated as well. For example, let’s say you want to increase the price of red items only by 15%. In that case, you could use this formula in column E to calculate a new price:

The test is the same as before (B6=“red”). If the result is TRUE, we multiply the original price by 1.15 (increase by 15%). If the result of the test is FALSE, we simply use the original price as-is.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.