How can you tell a spreadsheet to replace blank cells with the data from cell immediately above?

dbwiz

Active Member
Joined
Nov 20, 2007
Messages
275
I have a spreadsheet where Column A contains group numbers and Column B contains names. The other columns show dates and payments. Occasionally the same group number and name pays for multiple dates, and unfortunately, only shows on the first row. We are manually going down the list and copy/pasting the group number and name from the row right above it in order to be able to sort by date or amount without losing the name - but I am sure you guys have a much better way of doing this - perhaps as a macro?

As always any help is greatly appreciated.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,358
Office Version
  1. 365
Platform
  1. Windows
  1. Select the column with the blanks.
  2. Goto Edit>Goto...Special and select blanks.
  3. Goto the formula bar, enter =A1 (or whatever the first cell with data is) and then press CTRL+ENTER.
  4. Select the column, copy and paste special values.
 
Upvote 0

Domski

Well-known Member
Joined
Jan 18, 2005
Messages
7,292
Maybe try this:

- Select your whole range of data

- Press F5 and click on Special and then Blanks.

- Type = and then press the up cursor once and a formula should appear in your first blank cell referencing the complete cell above it.

- Press ctrl+enter

- Select the whole list and Copy...paste special...values

Hope it helps,

Dom
 
Upvote 0

hatepoppy

Board Regular
Joined
Jan 10, 2008
Messages
115
I have a spreadsheet where Column A contains group numbers and Column B contains names. The other columns show dates and payments. Occasionally the same group number and name pays for multiple dates, and unfortunately, only shows on the first row. We are manually going down the list and copy/pasting the group number and name from the row right above it in order to be able to sort by date or amount without losing the name - but I am sure you guys have a much better way of doing this - perhaps as a macro?

As always any help is greatly appreciated.


if all else fails, this is an easy macro. just specify the correct cells and thisll do'er.

Code:
Sub Replace_Blanks_With_Above_Value()
    For i = 1 To 10
 
        If Len(Cells(i, 10).Value) < 1 Then
 
            Cells(i, 10).Value = Cells(i - 1, 10).Value
 
        End If
 
    Next
End Sub
 
Upvote 0

jmthompson

Well-known Member
Joined
Mar 31, 2008
Messages
966
After re-reading your request, I have another question:
Will your blank cells always have a cell with data immediately above or are there situations where that information is in one row and then left off for several rows?
 
Upvote 0

Forum statistics

Threads
1,190,959
Messages
5,983,855
Members
439,867
Latest member
Shadrack

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
Top