If you want to do something specific when a cell equals a certain value, you can use the IF function to test the value, then do something if the result is TRUE, and (optionally) do something else if the result of the test is FALSE.
If color is red, mark with “x”
In the example shown, we simply want to “mark” or “flag” records where the color is red. In other words, we want to check cells in column xxx, and then take action when they contain the word “blue”.
In D6, the formula were using is this:
In this formula, the logical test is this bit:
This will return TRUE if the value in B6 is “blue” 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. Here, we are simply adding an “x” to column D if when the color is blue. If the color is not blue (or blank, etc.) , we simply add an empty string (“”).
The result is an x where the color is blue, and nothing if not.
Note: if we didn’t add that empty string when FALSE, the formula would display FALSE whenever the color is not blue.
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=”blue”). 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.