Solved

Populate blank cells with cell above

Posted on 2015-02-04
5
53 Views
Last Modified: 2015-02-04
Hello,

I have an excel spreadsheet.
There are many blank cells
basically i drag down the cell above up but not including the next populated cell below and continue the process until done.
this is tedious and time consuming if you have many blank cells in hundreds of rows.

how can I use a formula for this?
 
please see attached
Populate-EE.xlsx
0
Comment
Question by:pdvsa
5 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
Comment Utility
I don't know what you mean.

However, if you want to fill in blank cells:

1. Add a filter.
2. Filter on blanks "(blank)".
3. In the first blank cell - let's say it's A2:
a. If you wanted the cell above, enter =A1
b. If you wanted the cell below, enter = A3
4. Copy this cell.
5. Paste it into all of the other blank cells.

That will populate an entire column at once without overwriting cells which already have information.
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
Here's a macro

Sub FillEm()
Dim lngLastRow As Long
Dim lngLastColumn As Long
Dim lngRow As Long
Dim lngCol As Long

lngLastColumn = Cells.Find("*", SearchOrder:=xlByColumns, LookIn:=xlValues, SearchDirection:=xlPrevious).Column
lngLastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For lngRow = lngLastRow To 2 Step -1
    For lngCol = 1 To lngLastColumn
        If Cells(lngRow, lngCol) = "" Then
            Cells(lngRow, lngCol) = Cells(lngRow - 1, lngCol)
        End If
    Next
Next

End Sub

Open in new window

0
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
Comment Utility
1 Select column A.

2 Goto Find & Select>Goto Special....Blanks.

3 Type =A2 in the formula bar and confirm with CTRL+ENTER.

4 Optional. Select column A, copy and paste special values.

If you want code.
Sub FillBlanks()
    With Range("A:A")
        .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
        .Value = .Value
    End With
End Sub

Open in new window

0
 

Author Closing Comment

by:pdvsa
Comment Utility
nery nice.
0
 

Author Comment

by:pdvsa
Comment Utility
Philip, I Reread  your answer and I think you are essentially stating what Norie has stated  however I think Norie has a slightly different solution with finding blanks and replacing with cell above.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now