How to write formula If blank add?

Posted on 2013-10-06
Medium Priority
Last Modified: 2013-10-06
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.
Question by:Jimi Sherman
  • 2
LVL 14

Expert Comment

ID: 39551232

Open in new window


Open in new window

copy the formula to other cells

Author Comment

by:Jimi Sherman
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.
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"
End Sub

Open in new window


Author Closing Comment

by:Jimi Sherman
ID: 39551274
Thanks again,

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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.

Join & Write a Comment

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question