HomeGoogle DocsSpreadsheetHow to Fill Zero in Blank Cells in Google Sheets

How to Fill Zero in Blank Cells in Google Sheets

Published on

To fill zero values in blank cells, you can use either the Find and Replace command or a formula in Google Sheets.

Find and Replace command:

This method is suitable for filling zero in blank cells in a data range that doesn’t contain formulas.

The reason for its suitability lies in how it handles formulas:

If a formula in the range returns a single value (non-array formula) and that value is blank, this approach will replace that formula with zero. However, if a formula in the range returns multiple values (array formula) and any of the values are blank, the formula will replace that cell with zero, potentially breaking the formula as it may not expand due to the newly filled value.

Formula Approach:

You can use it with existing formulas to replace blanks with zero, or apply a standalone formula to populate a new range with blank cells filled with zero.

It’s important to understand both options to effectively manage your data in Google Sheets.

Find and Replace to Fill Blank Cells with Zeros

I have data in columns A and B (cell range A1:B11), and some cells in column B are blank. There are no formulas in use anywhere in this range.

Sample Data with Empty Cells in Second Column

Note: You can use a highlighting rule to easily find any cell in the range containing formulas. You can check out: How to Highlight All the Cells with Formulas in Google Sheets.

I want to fill those blank cells with the value zero while keeping the other values in that range intact.

Steps to Follow:

  1. Format Cells as Plain Text and Revert to Automatic (Must Do):
    • Select the range where you want to fill blank cells with zeros, here B1:B11.
    • Click Format > Number > Plain Text. This will format the numbers as text.
    • While keeping the selection, click on Format > Number > Automatic to revert to the original formatting.
  2. Find and Replace:
    • Select the range B1:B11 if not already selected.
    • Click Edit > Find and Replace (you can alternatively use the keyboard shortcut Ctrl + H in Windows or ⌘ + Shift + H in Mac).
    • In the Find field in the Find and Replace window, enter the following regular expression: ^\s*$
    • In the Replace with field, enter 0.
    • Tick “Search using regular expressions” and “Match case.”
    • Click Replace All.
Replace Empty Cells with 0 in Google Sheets using Find and Replace

This will fill all blank cells in B1:B11 with zeros while retaining other values in the range.

Formula Approach to Replace Blank Cells with Zeros

As mentioned, using Find and Replace might not be feasible in a complex data range containing formulas.

In such cases, you can use a formula with the drawback that it generates a new range with blank cells replaced with zero.

Generic Formula:

=ArrayFormula(LET(range, range_reference, IF(range="", 0, range)))

In this formula, replace range_reference with the range in which you want to replace blanks with zero values.

For example, in our previous scenario, you can use the following formula in cell C1:

=ArrayFormula(LET(range, B1:B11, IF(range="", 0, range)))

However, if you’re using an array formula such as a FILTER or QUERY that contains blank cells in their output, you can still follow the above generic formula. In that case, replace range_reference with the formula in question itself.

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

Excel Word Count: Beyond SUBSTITUTE

You might want to count the number of words in a cell in Excel...

More like this

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.