There is nothing more satisfying than checking a box and enjoying one thing off your list complete...wait, there is! The whole row strike through or the coloured row! Bold, italicize...<breaths into a paper bag>
I'm back. Sorry about that, I really like using conditional formatting to indicate specific data or to respond to a user. It makes the spreadsheet come alive.
What is conditional formatting? It is the ability to change a cell's (or range, row, column) formatting based on a value.
So this:
To this:
There are basically two types: Same cell and same and/or other cells.
Want to work along with me? Here is the sample data all typed out.
Same Cell
Let's start with this data:
Let's indicate what is greater than $100 in sales.
- Highlight B2 to B7
- There are a bunch of ways to get to conditional formatting:
- Right click, click on "View more cell actions" and then select "Conditional formatting"
- Click on the font or font background colour and select "Conditional formatting"
- "Format" -> "Conditional formatting"
- In the new window, notice that the range is already added
- Under "Format cells if..." click on the drop down and select "Greater than".
- Leave the colour setup alone for now and click "Done"
Notice how the $300 and $500 are highlighted in green.
Select B2:B7 again and access the conditional formatting see if you can:
- Make the numbers less than or equal to $100 show in red.
- Click on "Color scale" and see if you can get the $50 in red and the $500 in green.
Now that you've had a little practice with the single cell, let's try a row or range.
Same And/Or Other Cells
This is where things get a bit more advanced. We can now specify what we want to change colour based on a value of a cell.
Let's use this example and indicate where the weekly sales are larger than $200:
- Highlight A2 to C7
- Activate conditional formatting
- Leave the range alone
- At this step you can modify the cells you want to colour but they need to be continuous
- Click on the drop down under "Format cells if..."
- Scroll all the way down to "Custom"
- In the "Value or formula" box enter:
- =$B2>200
- $ means that it will only check column B in the range
- always make sure that the row number (i.e. 2) matches the top row of the range (A2 to C7)
And now we have this:
Note: this custom formula can be used on single cells also
One last trick, let's combine a few things to make something really special.
Let's find a way to make this so if the number of customers is blank, it will indicate that:
- Select A2 to D7
- Activate conditional formatting
- Click on the drop down under "Format cells if..." and select "Custom"
- Enter this into the "Value or formula" box:
- =$D2=""
And here are the results:
Well, that is not right. I wanted the row to colour to show that someone forgot to put in the "Number of Customers" which, I think, is more important than Frank and his $300 in sales.
This is where the conditional formatting hierarchy comes in.
- Click on the box kitty corner to the A and the 1
- Activate conditional formatting
- Notice that there are two and if you hover your mouse over them, they have a little "grippy" bar to the left:
- Move the top one (i.e. =$B2>200) to the bottom by clicking and dragging on the "grippy" bar
- Now we get this:
One last trick...I am always adding in pieces that allow for expansion so what happens if I extend the range all the way down so we can add in further weeks? So, both conditional ranges become "A2:D1000":
That is just p-ugly (pretty ugly!) and not right. Let's go into the conditional formatting and fix this.
- Click on the box kitty corner to the A and 1.
- Activate conditional formatting
- Click on the top conditional format.(i.e. =$D2="")
- Make sure that the "Apply to range" is set to:
- A2:D
- Change the custom equation to:
- =if(isblank($A2),,$D2="")
- isblank() -> checks to see if a cell is empty
- if ->allows the spreadsheet to make a decision
- in this case, it checks to see if the first cell in the row is blank
- if it is, do nothing (i.e. nothing between the commas)
- if it is not blank, do the next thing (i.e. $D="" which checks for an empty customer count)
Note: The $ still must be used or it reverts to a per cell decision and messes it all up.
Well, there is many more items to play with but this should get you started. May your spreadsheets be colourful but meaningful. In the comments below, let me know how you can use conditional formatting to make your job easier.
Comments ()