Fill Blank Cells with 0 in Excel (3 Easy Ways) (2024)

Sometimes you will have a data set that has blank cells in it that you need to fill with a 0.

I have often found this to be a case with some databases where when you export the data, the cells that contain zero are often left blank. This could also be the case where data is manually entered, and 0’s are not entered, leaving the cell blank.

While you always have an option to manually select and enter 0 in a blank cell, doing so for a large data set would be quite tedious and inefficient.

In this tutorial, I’m going to show you three simple methods you can use to fill blank cells with 0 (zero) in Excel.

Table of Contents

Fill Empty Cells with 0 in Excel

In this section, I will show you three ways to quickly fill all the blank cells with zero in Excel.

Two of these methods (‘Find & Replace’ and ‘Go To Special’) use the in-built Excel functionalities, and the third method uses a simple VBA code.

Using the Find and Replace to Find Blank Cells and Replace it with 0

Let me first show you the best way to fill blank cells with 0 in Excel – using the Find and Replace functionality.

With Find and Replace, you can quickly find all the cells that are blank in your data set, and replace the content of these cells with a 0.

Below I have a data set where I have the sales values for different stores in four quarters. as you would see, there are some cells that are empty, and I want to fill these blank cells with 0.

Fill Blank Cells with 0 in Excel (3 Easy Ways) (1)

Here are the steps you can use to fill blank cells with 0 using Find and Replace:

  1. Select the data set where you have the blank cells that you need to fill with 0
  2. Click the Home tab
  1. In the Editing section, click on ‘Find & Select’
  2. Click on ‘Replace’. This will open the Find and Replace dialog box
Fill Blank Cells with 0 in Excel (3 Easy Ways) (3)
  1. Leave the ‘Find what’ field empty (As we need to find all the cells that are empty/blank)
Fill Blank Cells with 0 in Excel (3 Easy Ways) (4)
  1. In the ‘Replace with’ field, enter 0
Fill Blank Cells with 0 in Excel (3 Easy Ways) (5)
  1. Click on Replace All
Fill Blank Cells with 0 in Excel (3 Easy Ways) (6)

As soon as you click on the replace all button in step 7, it will fill all the blank cells with a 0.

Fill Blank Cells with 0 in Excel (3 Easy Ways) (7)

It will also show you a prompt to tell you how many cells have been filled with zero.

Fill Blank Cells with 0 in Excel (3 Easy Ways) (8)

One important thing to note when using find and replace to fill all the blank cells with zero is to make sure that the blank cells are in fact empty. They should not have any space character or an apostrophe that may make them look empty while they’re not.

Pro Tip: You can use the keyboard shortcut Control + H to open the Find & Replace dialog box. To do this, select the data set, then hold the Control key, and then press the H key

Also read: How to Replace Zero with Dash in Excel?

Using the Go to Special Technique to Select Blank Cells and Enter 0

Another easy way to quickly fill all the blank cells with 0 is by using the go to special dialog box method.

Using the Go To Special functionality, you can quickly select all the cells that are blank. Once these blank cells are selected, you can manually fill these with 0 (with a keyboard shortcut that would fill zero in all the blank cells in one go).

Below again I have the same data set where I have the sales values for four quarters, and there are some blank cells that I need to fill with zeros.

Fill Blank Cells with 0 in Excel (3 Easy Ways) (9)

Here are the steps to fill blank cells with 0 using Go To special method:

  1. Select the entire data set where you have the blank cells that you want to fill with 0
  2. Press the F5 key to open the Go To dialog box
  3. Click on the ‘Special’ button, which will open the Go To Special dialog box
Fill Blank Cells with 0 in Excel (3 Easy Ways) (10)
  1. In the Go To Special dialog box that opens, select the ‘Blanks’ option button
Fill Blank Cells with 0 in Excel (3 Easy Ways) (11)
  1. Click OK. You will now see that all the blank cells in the data set have been selected
Fill Blank Cells with 0 in Excel (3 Easy Ways) (12)
  1. Enter 0 using your keyboard. you will notice that the zero is entered in one of the blank cells (which would be the active cell in the selection)
Fill Blank Cells with 0 in Excel (3 Easy Ways) (13)
  1. Hold the Control key and press the Enter key

Doing the above steps would enter 0 in all the blank cells in your selected data set.

Fill Blank Cells with 0 in Excel (3 Easy Ways) (14)

In this method, the Go To Special dialog box enables us to select all the blank cells while deselecting all the other cells that are not blank.

When you enter a 0 when all the blank cells are selected, this value is entered only in the active cell, but when you use the keyboard shortcut Control + Enter, it enters the value in the active cell (which is 0), in all the other selected blank cells.

While this may look like a long method as compared to the Find and Replace technique we used earlier, one benefit that this method offers is that it allows you to select all the blank cells in one go.

In our example, once we had all the blank cells selected, we entered 0 in it.

But you can also do other things such as

  • Enter any text value such as “Zero” or “NA” or “Not available”
  • Highlight these blank cells by giving these a background color
  • Delete rows that have the blank cells
Also read: Replace Zero with Dash in Excel

VBA Code to Fill Blank Cells with 0 (zero)

You can also use a simple VBA code to quickly fill all the blank cells with zeros.

Here is the VBA code that would go through each cell in the specified data set, and then check whether the cell is blank or not. and in case the cell is blank, it would enter a zero in that cell.

'Code developed by Steve Scott from https://spreadsheetplanet.com/Sub Fill_Blank_Cells_with_Dash()Dim myrng As RangeOn Error Resume NextSet myrng = Application.InputBox("Select the Range to fill blank cells with dash", "Fill Blanks with Dash", , , , , , 8)For Each Cell In myrng If Cell.Value = "" Then Cell.Value = 0 End IfNextEnd Sub

In the above VBA code, I have used the Application.InputBox method that would allow you to choose a range of cells that should be considered while running the code.

So when you execute this code, you will see a simple input box as shown below, that allows you to select the data set where you have the blank cells.

Once you select the range and click OK, the VBA code would be executed. it would go through each cell in the selection, and if it finds any blank cell, it would fill it with a 0.

There are multiple ways you can run this VBA code in Excel:

  • You can add this code to a module in the VBA editor and then run this code by hitting the F5 key or clicking on the run button in the menu in the VBA editor
  • You can assign a keyboard shortcut to this macro, and run this using that keyboard shortcut
  • You can save this macro in the Quick Access Toolbar so that you can run it with a single click

Note: If you’re adding this VBA code in a module in your excel file, make sure to save that excel file as a macro-enabled file (with a .XLSM extension). You can do this by clicking on the File tab, and then clicking on Save as. In the save as dialog box, you will have the option to save the file as a macro-enabled file (in the Save as type drop-down).

If filling blank cells with zeros is something you need to do quite often, then I would recommend you add this VBA code to your Personal Macro Workbook.

Once you do that, this code will be available in all the Excel files on your system. and if you assign a keyboard shortcut to it or add this to your Quick Access Toolbar, you will have easy access to run this macro in any Excel file (with a keyboard shortcut or with a click of a button in the quick access toolbar icon).

If you’re not sure what a personal macro workbook is and how it works, here is a great video I found that explains this in detail:

Why Fill Blank Cells with Zeros?

If you’re wondering why it’s a good idea to fill all the empty cells in your dataset with 0’s, here are some scenarios where it would be needed:

  • Many Excel formulas (such as SUM or COUNT or AVERAGE) ignore blank cells. So if you’re using these formulas, and your input range has blank cells, these cells would be ignored. This also means that formulas such as COUNT or AVERAGE would not give you the right result. In such cases, filling these blank cells with 0 would solve this issue
  • If you’re creating charts with data that has blank cells, some charts (such as line charts) show gaps in places where there are blank cells. and if you fill these blank cells with 0, the same line chart is going to show you a continuous line with no breaks.
  • This is my personal use case where I want to fill all the blank cells with 0 (auto dash or any other character) just to make sure that I do not have any blank cells in the column. this helps me to quickly jump to the last filled cell in the column by using the keyboard shortcut CTRL and down arrow key (which wouldn’t work if I have blank cells as the cursor would always go to the last filled cell before the blank.

These are some of the reasons that I have come across where it makes sense to fill all the blank cells with 0 (zero), but I’m sure there would be other reasons as well.

In this tutorial I showed you three easy ways you can use to quickly fill all the blank cells with 0 in Excel.

The fastest way would be to use the Find and Replace technique which finds all the blank cells and replace the content of these cells with 0 (or any value that you specify).

You can also use the Go To Special method, which allows you to select all the blank cells and then manually enter 0 in all the blank cells in one go.

And finally, I showed you the VBA method that allows you to quickly select a range of cells that have blank cells and fill these with zero.

I hope this Excel tutorial helps you in your day-to-day Excel tasks.

Other Excel tutorials you may also find useful:

  • How to Highlight Blank Cells in Excel?
  • Fill Blank Cells with Dash (-) in Excel
  • How to Fill Blank Cells with Value above in Excel
  • How to Remove Commas in Excel (from Numbers or Text String)
  • How to Find Merged Cells in Excel
  • How to Remove Leading Zeros in Excel
Fill Blank Cells with 0 in Excel (3 Easy Ways) (2024)

FAQs

How do you autofill blank cells in Excel? ›

Fill the cells

You can press "Ctrl Enter" instead of the "Enter" key to fill down your formula into the blank cells. You can also use the "Ctrl D" keyboard shortcut or double-click the "Autofill" button in the bottom right corner of your selection to fill in the cells.

How do I fill all blank cells at once? ›

Steps to Fill Blanks in Excel

With the blank cells selected, tap the “=” sign on the keyboard followed by the Upward pointing arrow on the keyboard to select the cell above the active cell. At this point, press CTRL + Enter simultaneously in order to fill all the selected cells at a go!

How do I fill blank cells in Excel without dragging? ›

Keyboard shortcut: You can also press Ctrl+D to fill the formula down a cell in a column, or Ctrl+R to fill the formula to the right in a row.

How to make empty cells blank in Excel? ›

Change empty cell display - Check the For empty cells show check box. In the box, type the value that you want to display in empty cells. To display blank cells, delete any characters in the box. To display zeros, clear the check box.

How do I randomly fill cells in Excel? ›

In the first cell underneath your heading row, type “= RAND()” Press “Enter,” and a random number will appear in the cell. Copy and paste the first cell into the other cells in this column. Once each row contains a random number, sort the records by Random_number column.

How do I make blank cells default to zero in Excel? ›

Go to File > Options > Advanced. Under Display options for this worksheet, select a worksheet, and then do one of the following: To display zero (0) values in cells, check the Show a zero in cells that have zero value check box.

How do I put 0 in front of all numbers in Excel? ›

Use the "0"# format when you want to display one leading zero. When you use this format, the numbers that you type and the numbers that Microsoft Excel displays are listed in the following table. Example 2: Use the "000"# format when you want to display three leading zeros.

How do you add 0 to all cells? ›

Select a cell(s) where you want to show leading zeros, and press Ctrl+1 to open the Format Cells dialog. Under Category, select Custom. Type a format code in the Type box. In most cases, you will need a format code consisting of 0 placeholders, like 00.

How to fill empty cells with 0 in sheet? ›

In the 'Find' field, select 'Blank' and in the 'Replace With' field, enter '0'.

Top Articles
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 6524

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.