How to autofill n times of each value in a column, that are separated by different numbers of empty cells

Ixcel

New Member
Joined
Dec 5, 2020
Messages
2
Platform
  1. MacOS
I have a column with some values that are separated by different number of empty cells. How can I copy each of these value to the n empty cells below them? In my case n = 3 is no bigger than the minimum number of empty space between them.
 

Attachments

  • Screen Shot 2020-12-05 at 10.50.09.png
    Screen Shot 2020-12-05 at 10.50.09.png
    13.2 KB · Views: 3

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
13,956
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
Manually...

Select the range
Ctrl + G
Special
Blanks
Type = and press Ctrl and the Up arrow
Ctrl + Enter
Copy and Paste as values
 

Ixcel

New Member
Joined
Dec 5, 2020
Messages
2
Platform
  1. MacOS
Manually...

Select the range
Ctrl + G
Special
Blanks
Type = and press Ctrl and the Up arrow
Ctrl + Enter
Copy and Paste as values
Thanks for your reply. I know this methods, but it will autofill the value to all the empty cells below it. Like AAAAAAAAABBBBCCCC. I would like each value copied only 3 times, something like AAAA-----BBBBCCCC, -stands for empty cells.
 

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
13,956
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
Assuming that your data starts in A2 then maybe...
VBA Code:
Sub Ixcel()
    Dim i As Long
    For i = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
        If Cells(i, "A") <> "" Then Cells(i, "A").Resize(4).Value = Cells(i, "A").Value
    Next
End Sub

Edit:
Or a tiny bit better

VBA Code:
Sub Ixcel2()
    Dim i As Long
    For i = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
        If Cells(i, "A") <> "" And WorksheetFunction.CountA(Cells(i, "A").Offset(1).Resize(3)) = 0 Then Cells(i, "A").Resize(4).Value = Cells(i, "A").Value
    Next
End Sub
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,126,944
Messages
5,621,756
Members
415,854
Latest member
Tutu123

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