How to Show 0 Instead of Blank in Google Sheets

Blank cells in Google Sheets can cause issues when you’re working with calculations, charts, or dashboards. Inconsistent data can lead to misleading results or display errors, especially if you’re summing values or referencing cells across sheets.

In this article, we will demonstrate several easy ways to automatically display 0 instead of blank using built-in functions like IF, IFERROR, and array formulas. In this guide, you’ll learn practical methods to fill empty cells with zero, perfect for cleaning up financial models, inventory lists, grade books, and more.

Key Takeaways

Steps to replace blank cells with 0 in Google Sheets using the IF + ISBLANK function:
➤ Start with a dataset in cells A1:D11, containing some blank cells.
➤ In a new column (e.g., F2), enter the formula:
=IF(ISBLANK(D2), 0, D2)
➤ This formula checks if D2 is blank. If true, it returns 0; otherwise, it returns the original value.
➤ Drag the formula down to apply it to the rest of the column.
➤ The result is a clean column where all blank cells are replaced with 0s, preserving other values.

overview image

Download Practice Workbook
1

Use the IF Function to Replace Blanks with 0

One of the simplest ways to show 0 instead of a blank cell in Google Sheets is by using the IF function. This method checks if a cell is empty and returns 0 if it is, or shows the original value if not. It’s best used when you are referencing or displaying individual cells where blank values might occur.

This is the dataset we will be using to demonstrate the methods:

Use the IF Function to Replace Blanks with 0

Steps:

➤ Use the dataset in cells A1:D11, which contains Date, Region, Product, and Units Sold.
➤ Suppose you want to display the values in the “Units Sold” column (column D) in a new column while replacing blanks with 0. In cell F2, enter the following formula:

=IF(D2=””, 0, D2)

Use the IF Function to Replace Blanks with 0

Explanation
D2="": Checks if the cell in column D is blank.
0: Returns 0 if the condition is true (cell is blank).
D2: Returns the original value if the cell is not blank.

➤ Press Enter and drag the formula down from F2 to F11 to apply it to the rest of the rows.

Use the IF Function to Replace Blanks with 0

The cells that contain a value will remain unchanged, and the blank ones will be replaced with 0 in the new column.

➤ This method works well when dealing with individual blank cells and you want to keep the original data intact while displaying a cleaned-up version elsewhere.


2

Combine IFERROR with Arithmetic to Replace Blanks with 0

Another effective method to show 0 instead of blank in Google Sheets is by using the IFERROR function in combination with a simple arithmetic operation. When you perform a mathematical operation like adding 0 to a blank cell, it typically results in an error. IFERROR catches that and replaces it with 0. This is useful when dealing with numeric columns where you expect blanks that should be treated as zeroes.

Steps:

➤ Use the same dataset in cells A1:D11.
➤ To display values from the “Units Sold” column (column D) while showing 0 instead of blanks, enter this formula in cell F2:

=IFERROR(D2 + 0, 0)

Combine IFERROR with Arithmetic to Replace Blanks with 0

Explanation
E2 + 0: Attempts to add 0 to the cell, which triggers an error if D2 is blank.
IFERROR(..., 0): If an error occurs (because the cell is blank), 0 is returned instead.

➤ Press Enter and drag the formula down from F2 to F11 to apply it to the entire range.

Combine IFERROR with Arithmetic to Replace Blanks with 0

➤ This method is particularly useful in numeric calculations where blanks would otherwise disrupt formulas like SUM or AVERAGE.


3

Utilize IF with ISBLANK to Check and Replace Empty Cells with 0

The combination of IF and ISBLANK functions provides a straightforward way to check if a cell is empty and return 0 instead. This method is precise and easy to understand, making it a good choice when you want clear logic for handling blanks.

Steps:

➤ Continue using the dataset in cells A1:D11.
➤ To return the value from the “Units Sold” column (column D), but display 0 if the cell is blank, enter this formula in cell F2:

=IF(ISBLANK(D2), 0, D2)

Utilize IF with ISBLANK to Check and Replace Empty Cells with 0

Explanation
ISBLANK(D2): Checks whether cell D2 is blank.
IF(..., 0, D2): If D2 is blank, returns 0; otherwise, returns the actual value in D2.

➤ Press Enter and drag the formula down from F2 to F11 to apply it across the column.

Utilize IF with ISBLANK to Check and Replace Empty Cells with 0

➤ This method gives you full control over how blanks are handled and is especially helpful when you want to explicitly identify and substitute empty cells in a dataset.


4

Convert Blank Cells to Zero with ARRAYFORMULA and IF

Using ARRAYFORMULA combined with IF lets you convert blank cells to zero across an entire range dynamically. This approach is great when you want to apply the change to multiple rows without copying the formula down manually.

Steps:

➤ Assume you want to convert blanks in the Units Sold column (D2:D11) to zero and display the results in column F starting from F2. Enter this formula in cell F2:

=ARRAYFORMULA(IF(D2:D11 = “”, 0, D2:D11))

Convert Blank Cells to Zero with ARRAYFORMULA and IF

Explanation
IF(D2:D11 = "", 0, D2:D11): Checks if each cell in D2:D11 is blank; if yes, returns 0, otherwise keeps the original value.
ARRAYFORMULA(...): Applies the logic to the entire range at once, outputting all results in column F.

➤ Press Enter. The formula will be applied to the whole column automatically.

Convert Blank Cells to Zero with ARRAYFORMULA and IF

➤ This formula dynamically updates if you add or change data in the source range.

Convert Blank Cells to Zero with ARRAYFORMULA and IF

➤ This method is perfect for cleaning up columns quickly without writing multiple formulas or manual copying.


5

Apply the N Function to Convert Blank Cells to 0

The N function provides a quick way to convert blank or non-numeric cells into zeros. Unlike conditional formulas, N directly transforms any blank cell or text into a 0 while leaving numeric values untouched. This makes it a clean and lightweight approach when you want to avoid complex IF statements or nested conditions. It’s especially useful when working with numeric datasets where blanks might interfere with calculations or summaries. The N function is easy to apply to individual cells or entire ranges and requires minimal maintenance.

Steps:

➤ Suppose your dataset includes the Units Sold column in D2:D11, which may contain blank cells. To convert blanks to zero, enter this formula in cell F2:

=N(D2)

Apply the N Function to Convert Blank Cells to 0

Explanation
➧ The N function converts blank cells or any non-numeric values to 0 while leaving numbers unchanged.
➧ This is a straightforward way to replace blanks without using IF or ISBLANK conditions.
➧ You can apply it to individual cells or ranges by copying the formula down.

➤ Press Enter.

Apply the N Function to Convert Blank Cells to 0

➤ This method works best when you want a quick conversion with minimal formula complexity.


6

Implement Apps Script to Replace All Blank Cells with Zero (Advanced)

For users comfortable with scripting, Google Sheets’ Apps Script offers a powerful way to automatically replace all blank cells in a selected range or entire sheet with zeros. This method goes beyond formulas, allowing you to perform batch updates that permanently modify the sheet data. It’s particularly useful when dealing with large datasets or when you want to clean up your sheet once, avoiding the overhead of complex formulas recalculating in real-time. This approach requires basic knowledge of scripting but provides full control and automation.

Steps:

➤ Open your Google Sheets document and click on Extensions >> Apps Script.

Implement Apps Script to Replace All Blank Cells with Zero (Advanced)

➤ Delete any existing code in the editor and paste the following script:

function replaceBlanksWithZero() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var range = sheet.getDataRange();
  var values = range.getValues();
  for (var i = 0; i < values.length; i++) {
    for (var j = 0; j < values[i].length; j++) {
      if (values[i][j] === "" || values[i][j] === null) {
        values[i][j] = 0;
      }
    }
  }
  range.setValues(values);
}

Implement Apps Script to Replace All Blank Cells with Zero (Advanced)

Explanation
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); selects the currently active sheet where the script will run. Change this if you want to target a specific sheet by name.
var range = sheet.getDataRange(); gets the entire range of data with values on the active sheet. Modify this to a specific range if needed.
var values = range.getValues(); retrieves all cell values in the range as a 2D array for processing.
➧ The nested for loops iterate through each row (i) and column (j) in the array.
➧ The if condition with null values checks whether the current cell is blank or empty.
range.setValues(values); writes the modified array back to the sheet, updating all blank cells to zero.
➧ To use on another sheet or range, replace the getActiveSheet() and getDataRange() parts with specific sheet names or ranges.

➤ Save the script by clicking on the floppy disk icon.

Implement Apps Script to Replace All Blank Cells with Zero (Advanced)

➤ Close the Apps Script tab, return to your sheet, then go to Extensions >> Macros >> Import macro.

Implement Apps Script to Replace All Blank Cells with Zero (Advanced)

➤ Select replaceBlanksWithZero from the menu that pops up, and click on Add Function.

Implement Apps Script to Replace All Blank Cells with Zero (Advanced)

➤ Now run the macro from Extensions >> Macros >> replaceBlanksWithZero. The script will replace all blank cells in your sheet with zeros.

The blank cells will be replaced with 0.

Implement Apps Script to Replace All Blank Cells with Zero (Advanced)

➤ Use this method when you want a one-time, sheet-wide replacement of blanks with zeros, removing the need for ongoing formula management.


Frequently Asked Questions

What is the best formula to replace blank cells with 0 in Google Sheets?

The simplest and most flexible formula is =IF(ISBLANK(cell), 0, cell), which checks if a cell is blank and replaces it with 0. It works well for individual cells or ranges when used with ARRAYFORMULA.

Can I replace all blanks with 0 across a range without writing formulas in every cell?

Yes, by using ARRAYFORMULA with IF, you can apply the logic to an entire column or row. For example, =ARRAYFORMULA(IF(A2:A=””, 0, A2:A)) replaces blanks in column A starting from row 2.

What does the N function do when applied to a blank cell?

The N function converts blank or non-numeric values to 0 while leaving numbers unchanged. For example, =N(A2) returns 0 if A2 is blank or contains text, and the number itself if A2 is numeric.

How can I automatically replace all blank cells in my sheet using a script?

You can use Google Apps Script to scan your sheet and replace all blanks with 0. The script uses getValues(), loops through the data, checks for empty strings or nulls, replaces them with 0, and then writes the updated values back using setValues().

Will these methods affect formulas already present in the sheet?

Yes, if you overwrite formula cells using Apps Script or manual methods like Find and Replace, the formulas may be removed. Formula-based methods like IF, ISBLANK, and ARRAYFORMULA preserve dynamic behavior and are safer when working with live calculations.


Wrapping Up

Handling blank cells in Google Sheets is essential for maintaining clean, functional spreadsheets, mainly when working with calculations, dashboards, or reports. Whether you’re using simple formulas like IF and ISBLANK, using ARRAYFORMULA for entire columns, applying the N function, or writing a script for automation, each method helps ensure consistency by replacing blanks with 0. Choose the approach that best fits your dataset and workflow to avoid errors and keep your data analysis accurate and efficient.

ExcelInsider Team
We will be happy to hear your thoughts

Leave a reply

Excel Insider
Logo