Zeroes are valid data, but for various reasons you won’t always want to display them in an Excel sheet. When this is the case, you have at least three options. Your data and business requirements will dictate the method you choose.
Perhaps the simplest way to hide all zero values in a sheet is to let the worksheet do it. Just remember, this setting works at the sheet level. You must set it for each sheet in the workbook, as follows:
- Click the File menu and then choose Options (under Help). In Excel 2007, click the Office button and then click Excel Options. In Excel 2003, choose Options from the Tools menu.
- Choose Advanced in the left pane. In Excel 2003, click the View tab.
- In the Display Options For This Worksheet section, uncheck the Show A Zero In Cells That Have Zero Value.
- Click OK.
The sheet setting will hide all zero values in the sheet. If you want to hide specific zero values, but not all, you can use a numeric format instead:
- Select the cells that contain the zero values that you want to hide.
- Click the Home tab and click the Number group’s dialog launcher (the small arrow in the bottom-right corner. In Excel 2003, choose Cells from the Format menu.
- Click the Number tab (if necessary).
- Choose Custom from the Category list.
- Enter 0;-0;;@ in the Type field.
- Click OK.
Hidden 0s will still be visible in the Formula bar, or in the cell, if you edit in the cell. To undo this format, simply choose an alternate numeric format for the cells.
The numeric format shown above will hide literal zeroes and most returned by a formula. When you run into an exception, you can use a conditional format as follows:
- Select the cells that contain the 0s you want to hide.
- Click the Home tab and then click the Conditional Formatting option in the Styles group. Choose New Rule. In Excel 2003, choose Conditional Formatting from the Format menu, and skip to step 4.
- In the top pane, select the Format Only Cells That Contain option.
- From the second dropdown, choose Equal To.
- Enter 0 in the third control.
- Click Format.
- From the Color dropdown, choose White (or the color that matches the sheet’s background).
- Click OK twice.
This format is easy to forget and can cause trouble down the road, so choose this method carefully.
Of the three methods, the conditional formatting method is probably the least productive because of the potential to forget it; costs can run high with employing formatting tricks. The sheet and numeric format methods are more straightforward and require little effort.
Subscribe to the Developer Insider Newsletter
From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays