Skip to content

How to return blank instead of zero in Excel and Google Sheets

Topic:IF, IFS & nested conditions
Excel & Google Sheets
=IF(A2-B2=0,"",A2-B2)

Verified example

Computed by a real spreadsheet engine on the sample data below.

Value AValue BDifference
100100
150100
7575
200120

=IF(A2-B2=0,"",A2-B2)

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Formula-level fix: wrap the calculation in IF and return an empty string for zero: =IF(A2-B2=0,"",A2-B2).
  2. 2Avoid computing twice in modern Excel with LET: =LET(v,A2-B2,IF(v=0,"",v)) evaluates the calculation once.
  3. 3Display-level fix: keep the real zeros but hide them with a custom number format — select the cells and apply the format 0;-0;;@ (positive;negative;zero;text — the empty third slot suppresses zeros).
  4. 4Sheet-level fix in Excel: File → Options → Advanced → untick "Show a zero in cells that have zero value" for the whole worksheet.
  5. 5The lookup case: VLOOKUP returns 0 when the found cell is empty. Fix with =IF(VLOOKUP(D2,A:B,2,0)="","",VLOOKUP(D2,A:B,2,0)) or =LET(v,VLOOKUP(D2,A:B,2,0),IF(v="","",v)).

Tips

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

Will the blank "" break SUM or AVERAGE?

No. SUM and AVERAGE skip text values, and "" is text — so totals and averages behave exactly as if the cell were empty.

Why does my VLOOKUP return 0 instead of blank?

When the looked-up cell is empty, VLOOKUP converts the blank to 0. Wrap it: =IF(VLOOKUP(D2,A:B,2,0)="","",VLOOKUP(D2,A:B,2,0)) — or use LET to avoid the double lookup.

Is a cell containing "" really blank?

No — it holds a zero-length text string. ISBLANK(A2) is FALSE, COUNTA counts it, and A2+1 errors. If those matters, hide zeros with the number format 0;-0;;@ instead, which keeps the underlying number.

How do I hide zeros for the whole sheet at once?

Excel: File → Options → Advanced → untick "Show a zero in cells that have zero value". Google Sheets has no sheet-wide switch — use the custom number format 0;-0;;@ on the range instead.

What should a chart do with the blank result?

"" plots as a gap in most chart types. In Excel, returning NA() instead makes line charts interpolate or skip the point cleanly; in Sheets, leave "" and enable "Plot null values" options per chart as needed.

More on IF, IFS & nested conditions

See all →

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: