Stay on Top of Enterprise Technology Trends
Get updates impacting your industry from our GigaOm Research Community
This is the first in a series on some of the more advanced functionality of Numbers, my favorite spreadsheet app. If you’re new to spreadsheets, or just want to make them look a little less like Microsoft Excel, this article should be right up your alley. In this article, we’ll talk about conditional formatting.
What is conditional formatting?
The real power behind spreadsheets is not just how well they can crunch data, but how you can visually present the information in a variety of ways. Sometimes, however, you may want to give more attention to a particular area, or hide certain data if it’s not relevant. You often see conditional formatting applied to financial spreadsheets where positive values are in black or green, but negative values are always in “the red.” So how do you do that? It’s where conditional formatting, or formatting based on certain criteria, comes into play.
Here’s a quick example. Let’s say I have something that shows you my net worth for each month of the year. (These numbers are entirely made up, for demonstration purposes.) Assuming that these numbers were coming from a different spreadsheet, I could likely have one of three possible values for each month. If I were doing well, the value would be a positive number. If I were feeling the toils on the economy and not so great at managing money, the value might be negative. The last option would be if we haven’t gotten to a particular month yet, for example, in September 2009 the value reads “$0” as no data yet exists to calculate that value.
Applying some formatting
Based on this example, you can see that before I begin to do any formatting, I have a mix of positive values, negative values, and some that read “$0” because we haven’t yet entered data for those months. To apply formatting, I would select the first cell next to January.
In the Inspector under the Cells tab, you’ll see an area that is labeled “Conditional Format” with zero rules applied. If I click “show rules” I will get a new window that allows me to start stacking on a series of rules that I want to compare this cell against.
For this example, I’m going to pick “Choose a rule” and select “Greater than.” If I enter “0” as my value, I’m telling Numbers that I want to apply special formatting to any value that is greater than zero. This would be where my net worth was in the positive numbers. If I click the “edit” button, I can now start layering on formatting. To keep things simple, I’m just going to change the text color to green and press “done.” You do have options here for a variety of other formatting choices, including bold or italics and changing the cell background. Looking back at your document, you should see that the value has now turned green!
Now I’m going to apply another rule, this time to address negative net worth. This rule is going to be “less than 0” and I am going to format the text to be a red color with bold styling.
Finally, I am going to apply one last rule, which will address the “0” values for upcoming months. Usually, you will not see a net worth perfectly at “0,” so I have used this assumption to keep our “0” values open for this next example. If a value is “0,” we’re assuming its because we are at a month in which nothing has happened yet, so we will simply want to “hide” this value until an actual value (positive or negative) can take its place. To solve this, we’re going to format the cell to take values that are “0” and turn the text white, so it will simply blend in with our background and therefore be hidden.
One down. A few to go.
Once we are finished here, we can close this window and go back to our spreadsheet. Now we’ve laid out the set of conditional formatting rules, but they currently only apply to the net worth listed in January. The next step most would take is to simply grab the little dot on the right of the cell and drag down to “fill” down, but do not do this. You will inadvertently fill down the value of that cell and not its formatting.
The last trick up my sleeve is how to copy formatting between cells and that is to use a feature called “Copy Style.” This is similar to the “Format Painter” of Microsoft Excel. Simply highlight the cell we were working on, go to the Format menu and select “Copy Style.” You can then highlight the remaining cells, go back to the Format menu and select “Paste Style” and you should end up with something that looks like the image to the right.
The Copy/Paste Style is a very useful tool and is found in all of the iWork applications. There is even a quick button to access it that you can add to your toolbar (open the View menu and then click “Customize Toolbar”).
If you are familiar with Conditional Formatting from Excel, nothing has really changed except the limit to the number of rules you can apply. Microsoft Excel previously limited users to applying three rules to a cell (usually that was more than enough) and, as far as I’ve found, Numbers imposes no limit. In the next article, we’re going to dig a little deeper into the power of Numbers with how to do horizontal and vertical lookups. If you have any Numbers-specific topics you would like me to cover, please use the comments below and let’s get the discussion started!