Insert 0 in blank cells

Steve Brown

New Member
Joined
Jan 8, 2021
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
I don't have much experience with Excel. I have a large spreadsheet with many blank cells. I want to insert a zero in every blank cell. I tried some IF statements, but they were not successful. Any help would be greatly appreciated.

Steve Brown
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
What formula are you using currently in those blank cells ?
You could also try this
File>>Options>>Advanced>>Display options for this worksheet>>tick the box "Show a zero in cells that have a zero value"
 
Upvote 0
Thanks for your prompt reply!

The "show a zero in cells that have a zero value" box is already checked.
I'll have to recreate the IF statement that I tried.
 
Upvote 0
Ok, can you post that IF formula ?
 
Upvote 0
The first 3 rows are not relevant to this issue. Starting in row 4 I want to check if the cell is blank. If the cell is blank, insert the value 0. If the cell is not blank, move onto the next cell in the column.

Here it is: =IF(B4="",B4=0)

It works fine for cell B4, but if I paste the formula into the rest of the column, I get all zeroes. I thought it was checking the value in b4, but after applying the IF statement to b4, the value in b4 is zero, not blank, so that's not what's happening.
 
Upvote 0
If you want to check col "B" you will need VBA
Try using
VBA Code:
Sub MM1()
 Dim r As Long
 For r = 4 To Cells(Rows.Count, "B").End(xlUp).Row
    If Cells(4, "B") = "" Then Cells(4, "B") = "0"
Next r
End Sub
 
Upvote 0
If you want to check col "B" you will need VBA
Try using
VBA Code:
Sub MM1()
Dim r As Long
For r = 4 To Cells(Rows.Count, "B").End(xlUp).Row
    If Cells(4, "B") = "" Then Cells(4, "B") = "0"
Next r
End Sub
Great, I want to try this (neophyte speaking here). How do I apply it?
 
Upvote 0
To insert the code
Press Alt + F11>>In the LH window select "This workbook" then paste the code in the RH window where the cursor is flashing.
To run the code on the activesheet Press ALt + F8 and select MM1 from the list provided and press "Run"
 
Upvote 0
Sorry to be so obtuse, but when I press alt F11, the computer wants to lower its volume.
 
Upvote 0

Forum statistics

Threads
1,215,065
Messages
6,122,944
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top