To make an Excel chart show only cells with data, the most effective method is to convert your data range into an official Excel Table (Ctrl + T) or use a Filter to hide blank rows. Excel charts are designed to ignore rows that are hidden by a filter, meaning that as you filter out blanks, the chart automatically updates to show only the remaining data points.
This process is essential for dashboards and reports where data is entered incrementally. Without these steps, Excel often treats empty cells as zeros or leaves large gaps in your timeline, which distorts the visual representation of your trends.
What You'll Need
- Microsoft Excel (Desktop version recommended for full functionality).
- A dataset containing some empty cells or "placeholder" rows that you wish to exclude from your visualization.
Step-by-Step
Method 1: Using the Table Filter (Fastest Method)
This is the simplest way to remove blanks from a chart. Because charts generally do not plot hidden rows, filtering the source data is the most direct solution. Note that menu labels may differ slightly depending on your version of Excel or region.
- Select the range of cells that contains your data.
- Go to the Insert tab and click Table (or press Ctrl + T). Ensure "My table has headers" is checked and click OK.
- Click the drop-down arrow in the header of the column that contains the blanks.
- Uncheck the box next to (Blanks) at the bottom of the filter list and click OK.
- Select your filtered data and go to Insert to create your chart. The chart will now only display the visible, populated rows.
Method 2: Handling #N/A for Formula-Driven Blanks
If your "empty" cells actually contain formulas that return a blank string (like =""), Excel still sees those cells as containing data, and the chart will often plot them as zeros. To fix this, you must force Excel to see them as truly empty using the #N/A error.
- Locate the formula causing the blank cell. For example, if you have:
=IF(A1="", "", A1). - Change the formula to return NA() instead of a blank string:
=IF(A1="", NA(), A1). - Your cells will now display
#N/A. While this looks messy in the spreadsheet, Excel's charting engine ignores #N/A values in line and scatter charts rather than plotting them as zero. - Right-click the chart and select Select Data.
- Click the Hidden and Empty Cells button.
- Ensure that the option for empty cells is set to Gaps or Connect data points with line, depending on your preference.
Method 3: Creating a Dynamic Named Range (Advanced)
If you want the chart to expand automatically as you add new data without having to manually filter, you can use a Dynamic Named Range.
- Go to the Formulas tab and select Name Manager.
- Click New and give your range a name (e.g.,
ChartData). - In the "Refers to" box, enter an OFFSET formula. Example:
=OFFSET($A$1,0,0,COUNTA($A:$A),1). This tells Excel to start at A1 and only include rows that are not empty. - Repeat this for your values column.
- Right-click your chart, choose Select Data, and replace the static cell references (e.g.,
=Sheet1!$A$1:$A$10) with your named range (e.g.,=Sheet1!ChartData).
Common Mistakes
- Using Spacebars: Putting a space in a cell to make it "look" empty. Excel treats a space as a character/text, which will cause the chart to plot a point or break the line.
- Confusing Blank with Zero: A cell that is truly empty is different from a cell containing 0. If your chart shows a dip to the bottom axis, check if your formula is returning 0 instead of a blank or #N/A.
- Forgetting to Refresh: When using Tables, the chart updates automatically, but if you are using manual ranges, you must manually drag the data boundary to include new rows.
Tips
- Use Slicers: Once your data is in a Table (Method 1), go to Table Design > Insert Slicer. This gives you a visual button to quickly filter out blanks or specific categories without opening the filter menu.
- Conditional Formatting: If you use the #N/A method, use Conditional Formatting to turn the text white if the cell equals #N/A. This hides the error from the user while keeping the chart clean.
- Check Data Types: Ensure your numbers are formatted as "Number" or "General" and not "Text," otherwise the chart may not recognize the data points at all.
Troubleshooting
If your chart is still showing empty spaces or zeros after following these steps, try the following in order:
- Check for Hidden Characters: Select an "empty" cell and press Delete. If the chart point disappears, the cell contained a hidden space or non-printing character.
- Verify the "Hidden and Empty Cells" Setting: Right-click the chart > Select Data > Hidden and Empty Cells. Ensure "Show data in hidden rows and columns" is unchecked. If this is checked, filtering the table will not affect the chart.
- Restart the Chart: Sometimes, complex data ranges become "sticky." Delete the chart and recreate it using the filtered Table range to reset the connection.
Frequently Asked Questions
Why does my chart show a zero instead of a gap?
This happens because the cell contains a formula that returns an empty string ("") or a zero. Excel treats these as values. Use the NA() function to force Excel to ignore the cell.
Can I hide zeros but keep the blanks?
Yes. You can go to File > Options > Advanced and uncheck "Show a zero in cells that have zero value." However, for charts, it is better to use a custom number format (0;-0;;@) to hide zeros in the cells, though the chart may still plot them unless filtered.
Does the Table method work for all chart types?
Yes, the Table filter method works for Line, Column, Bar, and Pie charts. It is the most universal way to remove unwanted data from a visualization.
Will my chart update automatically when I add new data?
If you used the Insert > Table method, yes. When you type new data directly below the last row of the table, the table expands, and the chart automatically includes the new data.
What is the difference between "Gaps" and "Zero" in the chart settings?
Choosing "Gaps" leaves a physical break in the line where data is missing. Choosing "Zero" pulls the line down to the bottom axis. Choosing "Connect data points with line" draws a straight line between the two nearest available data points, skipping the blank entirely.