Excel Charts: How to Exclude Zero Values
In this article
Yes, you can stop an Excel chart from plotting zeros, and there are three reliable ways to do it: turn the zeros into blanks or #N/A errors with a formula, filter the source data so the zero rows are hidden, or set the chart to show gaps for empty cells. The cleanest method depends on whether the zeros come from formulas or from typed-in values, and this guide walks through all three options.
Why bother? Zero values drag line charts down to the axis, flatten averages in the visual, and generally misrepresent data where "zero" actually means "no data". Excel treats a zero as a real number, so it will always plot it unless you intervene. Everything below works in Excel for Windows and Mac; menu labels can differ slightly between versions, but the chart tools referenced here exist in all modern versions of Excel.
What You'll Need
- A spreadsheet in Excel (desktop or Microsoft 365) with data containing zero values
- A chart already created from that data, or the data ready to chart
- Basic familiarity with formulas such as IF, NA, and FILTER (helpful but not required for all methods)
Step-by-Step
Pick the method that matches your situation. Method 1 is best when your zeros are produced by formulas, Method 2 when they are typed in, and Method 3 is a quick chart-side fix.
Method 1: Return #N/A instead of zero (formula-driven data)
- Identify the cell or cells in your chart's source range where a formula produces a zero. For example, a lookup like
=VLOOKUP(...)returning 0 when nothing is found. - Wrap the formula in an IF test so it returns the #N/A error instead of zero:
=IF(A2=0, NA(), A2), or if the zero comes from a calculation,=IF(your_formula=0, NA(), your_formula). - Copy the adjusted formula down the whole column used by the chart.
- The #N/A errors look ugly, so optionally hide them with conditional formatting: select the range, go to Home > Conditional Formatting > New Rule > Format only cells that contain, choose Errors, and set the font colour to match the cell background.
- Click the chart and confirm the line now shows a gap where the zeros used to be. Excel skips #N/A values in line and scatter charts automatically.
Method 2: Filter out the zero rows (typed-in data)
- Select any cell in your data table.
- Go to Data > Filter (or press Ctrl+Shift+L) to add filter drop-down arrows to the header row.
- Click the drop-down arrow on the column that contains the zeros and untick the 0 checkbox in the values list (or use Number Filters > Does Not Equal and enter 0).
- Click OK. The zero rows are now hidden.
- By default, Excel charts do not plot data in hidden rows and columns, so the chart updates immediately. If yours still shows the zeros, click the chart, then Chart Design > Select Data > Hidden and Empty Cells, and make sure "Show data in hidden rows and columns" is unticked, then click OK twice.
Method 3: Replace zeros with empty cells
- Select the data range containing zeros (not the whole sheet).
- Press Ctrl+H to open Find and Replace.
- In "Find what" type 0 and in "Replace with" leave the box completely empty.
- Click Options and make sure "Match entire cell contents" is ticked. This is critical, otherwise you will strip every zero out of numbers like 10, 20, or 105.
- Click Replace All. The zeros become truly blank cells.
- If the chart shows gaps where you would prefer the line to connect across them, click the chart, go to Chart Design > Select Data > Hidden and Empty Cells, and choose "Connect data points with line". Choose "Show empty cells as gaps" if you prefer the gap.
Common Mistakes
- Replacing zeros without ticking "Match entire cell contents", which turns 100 into 1 and 205 into 25. Always tick it before Replace All.
- Using NA() in columns that feed other calculations. #N/A propagates through SUM and AVERAGE, breaking any totals that reference the same cells. In that case use IFERROR around the downstream formulas or use Method 2 instead.
- Assuming a blank-looking cell is empty. Cells containing "" from a formula like
=IF(A2=0,"",A2)are not empty; charts treat them as zero in many cases. Use NA() rather than "". - Having "Show data in hidden rows and columns" switched on from an earlier project, so filtering appears to do nothing to the chart.
- Confusing a genuine zero (a real measured value of 0) with missing data. Removing real zeros misrepresents the data, so only exclude zeros that genuinely mean "no data".
Tips
- Method 2 is the most reversible. Clear the filter and everything returns; no formulas are touched.
- If you use Microsoft 365, you can create a spill range that excludes zeros automatically, for example
=FILTER(A2:B20, B2:B20<>0), and point the chart at that spilled result instead of the raw data. - To keep totals working alongside #N/A values, use
=AGGREGATE(1,6,range)for an average or=SUMIF(range,"<>#N/A")-style approaches, or simply run totals on a separate helper column. - Bar and column charts handle blanks and #N/A slightly differently from line charts: bars simply disappear, which is usually exactly what you want.
- Before choosing a method, ask what the zero means. Temperature of 0°C, a bank balance of 0, or a genuine count of 0 should usually stay in the chart.
Troubleshooting
- Chart still plots zeros after filtering: open Chart Design > Select Data > Hidden and Empty Cells and untick "Show data in hidden rows and columns".
- Chart still plots zeros after replacing with NA(): check that the chart's series range actually points at the column you changed. Click the chart, then Chart Design > Select Data, and verify the series references.
- Replace All changed numbers you did not expect: press Ctrl+Z immediately to undo, then redo it with "Match entire cell contents" ticked.
- Line chart drops to zero at the last point: this usually means the series range extends past your data into empty cells that Excel treats as zero. Fix the range under Chart Design > Select Data > Edit Series.
- Totals show #N/A after Method 1: wrap your totals, for example
=SUM(IFERROR(B2:B20,0))entered as an array formula in older versions, or switch to Method 2. - Nothing changes in the chart at all: you may be looking at a cached picture rather than a live chart (a pasted image). Click it; a real chart shows chart borders and the Chart Design tab. If it is an image, delete it and insert a fresh chart via Insert > Charts.
Frequently Asked Questions
Does Excel have a built-in "ignore zeros" chart setting?
No. There is no checkbox in the chart options to skip zeros specifically. You have to convert zeros to blanks or #N/A errors, or hide the rows, as described above.
Should I use NA() or an empty cell?
For line charts, NA() is usually better because formulas returning "" are still plotted as zero, while #N/A is skipped. For typed data, genuinely empty cells are the cleanest option.
Will this work in Excel for the web?
Partly. Filtering and formulas work, but the Select Data > Hidden and Empty Cells dialog and some chart options are more limited in Excel for the web, so do the chart-side steps in the desktop app.
Does hiding rows instead of filtering also exclude them from the chart?
Yes. By default Excel charts skip data in hidden rows and columns, so manually hiding the zero rows works the same way as filtering, provided "Show data in hidden rows and columns" is unticked.
Why does my chart connect across the gaps instead of showing a break?
Because "Connect data points with line" is selected. Change it under Chart Design > Select Data > Hidden and Empty Cells to "Show empty cells as gaps".