Solved

# How to write formula If blank add?

Posted on 2013-10-06
Medium Priority
268 Views
Hi I need to make a formula that will fill in blank cells in column L with "N". If cells in column M are blank DO NOT fill in column L.
Thanks,
Jimi
0
Question by:Jimi Sherman
• 2

LVL 14

Expert Comment

ID: 39551232
``````=IF(M1="","","N")
``````
or
``````=IF(M1="","N","")
``````
copy the formula to other cells
0

Author Comment

ID: 39551240
Sorry that I forgot to say that there is already info in some of the cells in column L, so I cannot have a formula in that column. Sorry I did not sat that before.
Jimi
0

LVL 81

Accepted Solution

byundt earned 2000 total points
ID: 39551257
If you don't want to write over existing formulas in column L, then you could use the macro below to search columns L and M for rows where the formula in column L returns an empty string and column M is not blank.
``````Sub DefaultColumnL()
Dim cel As Range, rg As Range
Application.ScreenUpdating = False
Set rg = Range("M2")        'First cell with data in column M
Set rg = Range(rg, Cells(Rows.Count, rg.Column).End(xlUp))  'All the data in column M
Set rg = rg.Offset(0, -1)
For Each cel In rg.Cells
If cel.Value = "" And cel.Offset(0, 1).Value <> "" Then cel.Value = "N"
Next
End Sub
``````
0

Author Closing Comment

ID: 39551274
Thanks again,
Jimi
0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.