Fix Excel Chart Bar Disappearing When Using an IF Formula
Question details
The user's Excel chart fails to display a bar because the source data relies on an IF formula that outputs a text string instead of a valid number.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Creating a bar chart based on a dataset where values are dynamically generated by an IF formula.
- Observed behavior
- The chart bar does not render or disappears entirely because the formula outputs a numerical value formatted as text (e.g., enclosed in quotation marks).
Ensure your chart source data range is correctly selected and check if any rows or columns containing your data are currently hidden.
Correct the IF Formula to Return a Numeric Value
Modify the IF formula to output true numbers instead of text strings so the chart can read and plot the data correctly.
Excel charts require numerical values to plot data points like bars or lines. If your IF formula wraps a number in quotation marks (e.g., "1"), Excel treats it as text. Consequently, the chart ignores this text data, causing the corresponding bar to disappear.
Click on the cell containing the IF formula that generates the data for your chart.
Look at the formula bar at the top of the screen and check for quotation marks around your numerical output, such as =IF(ISTEXT(C3),"1","").
Delete the quotation marks around the number so Excel recognizes it as a numeric value. Change the formula to look like this: =IF(ISTEXT(C3),1,"").
Press Enter to save the change, then double-click or drag the fill handle at the bottom-right of the cell to apply the corrected formula down the rest of your data column.

Enable Chart to Show Data in Hidden Rows and Columns
Adjust your chart settings to continuously display data bars even if you hide the source data columns.
Create and Troubleshoot Charts Easily with WPS Spreadsheet
WPS Spreadsheet offers a highly compatible and intuitive interface for creating dynamic charts, writing formulas, and managing data visualization without format-related errors.
- 1. Open your workbook: Launch WPS Spreadsheet and open your existing .xlsx file.
- 2. Fix formula errors seamlessly: Select the cell with your IF formula and easily remove quotation marks from numbers in the accessible Formula Bar.
- 3. Manage chart data: Right-click your chart and use the "Select Data" option to quickly configure hidden rows and empty cell behaviors.
- 4. Export and share: Save your perfectly formatted chart as a standard Excel file or export it as a high-quality PDF.

Frequently Asked Questions
Why does Excel treat my formula numbers as text?
Excel treats numbers as text if they are enclosed in quotation marks within a formula (like "1"), if the cell format is pre-set to Text, or if the number is preceded by an apostrophe.
Can I keep my data columns hidden without losing my chart bars?
Yes. Right-click the chart, choose "Select Data," click on "Hidden and Empty Cells," and check the option "Show data in hidden rows and columns."
What happens if my IF formula returns an empty string ("")?
An empty string ("") is treated as text. Depending on your chart settings, it might be plotted as a zero or leave a gap. To explicitly instruct the chart to ignore the cell and draw a gap, you can use the NA() function instead of "" in your IF formula.




