Solved

Excel: Automatically Fill Gaps Based on Cells Above

Posted on 2009-04-03
4
1,099 Views
Last Modified: 2012-05-06
How do I automatically fill in the gaps in a column based on the values in the cell above.
Eg Cell A1 says "MR X", Cell A10 says "Mr Y" and Cell A20 says "Mr Z"
What is the macro that would automatically fill down to show the following ( I need a macro as Ithere is too much data to do a manual fill down). Thanks!

A1 Mr X
A2 Mr X
A3 Mr X
A4 Mr X
A5 Mr X
A6 Mr X
A7 Mr X
A8 Mr X
A9 Mr X
A10 Mr Y
A11 Mr Y
etc etc etc etc...





0
Comment
Question by:doolinn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 59

Accepted Solution

by:
Saurabh Singh Teotia earned 500 total points
ID: 24061418
Just follow these steps, You will be able to do what you are looking for...
  • Press F5  and then press special and hit ok
  • Hit Blanks and hit ok which will select the blank cells only.
  • Then in on of the blank sell do a reference to the cell above and enter it by ctrl+enter
This will show data in all the cells automatically which will have the fomrula in it.
Saurabh...
0
 
LVL 15

Expert Comment

by:yuk99
ID: 24061507
You can use this macro if your column is large.
Sub FillGaps()
If Selection.Cells(1, 1) = "" Then
    MsgBox "First cell is empty!", vbCritical
Exit Sub
End If
For Each c In Selection
    If c.Value = "" Then
        c.Value = c.Offset(-1, 0).Value
    End If
Next
End Sub

Open in new window

0
 
LVL 15

Expert Comment

by:yuk99
ID: 24061659
saurabh726,
Your solution is cool. I didn't know about it.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

724 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