To make an Excel bar chart ignore zero values, you must replace the zeros in your data source with the #N/A error using the formula =NA(). Excel treats #N/A as "no data" rather than a numerical zero, which prevents the chart from plotting a bar or a data point for those specific cells. This ensures your chart remains clean and focuses only on active data.
What You'll Need
- Microsoft Excel (Desktop version)
- A dataset containing numerical values and zeros that you wish to exclude from a chart
- A basic understanding of how to enter a formula in a cell
Step-by-Step
- Identify your data range: Locate the cells containing the zeros that are cluttering your bar chart.
- Create a helper column: It is best practice not to overwrite your raw data. Create a new column next to your original data specifically for the chart.
- Apply the NA formula: In the first cell of your helper column, enter a formula that checks if the original value is zero. For example, if your data is in cell A2, enter:
=IF(A2=0, NA(), A2). - Fill the formula down: Click the bottom-right corner of the cell (the fill handle) and drag it down to apply the formula to all rows in your dataset. You will now see #N/A appearing wherever there was a zero.
- Update the chart source:
- Right-click on your existing bar chart.
- Select Select Data... from the menu.
- In the Chart data range box, clear the old range and select the new helper column containing the #N/A values.
- Click OK.
- Verify the result: The bars corresponding to the #N/A values will disappear from the chart, leaving only the positive or negative values visible.
Common Mistakes
- Deleting the zeros: Simply deleting the zero or leaving the cell blank often results in Excel treating the value as zero anyway, or creating a gap in the axis that still takes up space.
- Using a space: Entering a space character (" ") turns the cell into a text string. Depending on your chart type, this can cause plotting errors or incorrect axis labeling.
- Applying formulas to raw data: Overwriting your source data with #N/A makes it difficult to perform sums or averages later, as any math operation involving #N/A will result in #N/A. Always use a helper column.
- Confusing #N/A with other errors: Only
#N/A(Not Available) is ignored by Excel charts. Other errors like#VALUE!or#DIV/0!may still be plotted or cause the chart to break.
Tips
- Hide #N/A in the spreadsheet: If you don't like seeing #N/A in your helper column, use Conditional Formatting. Set a rule that if a cell contains an error, the font color should be white (to match the background).
- Use Tables: Convert your data range into an official Excel Table (Ctrl + T). When you add new rows to a Table, your helper formulas and your chart will update automatically without needing to manually adjust the data range.
- Filter the data: If you don't want to use formulas, you can apply a Filter to your data range and uncheck "0". By default, Excel does not plot hidden rows, so the zero values will vanish from the chart.
Troubleshooting
If the zero values are still appearing or the chart looks incorrect, try these steps:
- Check the formula: Ensure you used
NA()and not"N/A". The first is a function that creates a specific error type; the second is just a piece of text. - Check Chart Settings: Right-click the chart, go to Select Data..., and click the Hidden and Empty Cells button. Ensure the settings are configured to handle empty cells as gaps or zeros depending on your preference, though the #N/A method usually overrides this.
- Refresh the Data: If using a Pivot Chart, remember that you must right-click the chart and select Refresh after changing the underlying data for the changes to take effect.
Frequently Asked Questions
Will using #N/A affect my calculations?
Yes. If you try to SUM or AVERAGE a range containing #N/A, the result will be #N/A. Use the AGGREGATE function or SUMIF to ignore errors when calculating totals from helper columns.
Can I hide zeros without using a helper column?
Yes, you can use a Filter on your data table to hide rows where the value is zero. Excel charts generally do not display data that is hidden by a filter.
Does this work for line charts too?
Yes, but the behavior is different. In a line chart, #N/A will create a gap in the line. You can change this in Select Data > Hidden and Empty Cells by choosing "Connect data points with line" to bridge the gap.
Is there a way to make zeros invisible using custom formatting?
Custom number formatting (e.g., 0;-0;;@) can make zeros invisible in the cells, but it does not hide them from the chart. The chart still sees the numerical value of zero and plots it.
What happens if I have negative values?
The =IF(A2=0, NA(), A2) formula only targets zeros. Negative values will remain as they are and will be plotted normally on the negative side of the axis.