Filling Series with non-sequential cell references

Prevost

Board Regular
Joined
Jan 23, 2014
Messages
198
Hi There. I have data that is taken once every 15 minutes, starting on the hour. I want to turn that into 1 minute interval data using just those 4 values. So for example, if temperature X is taken at 1:00 PM, then 1:01 PM = X, 1:02 PM = X and so on until 1:15 PM when a new temperature is recorded. How can I make that happen? I tried creating a new column and the first 15 cells referenced A1, then the next 15 cells referenced A2 and then tried to fill that series but it didn't work. Does anyone know how I can do this?
Thanks!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
.
.

Supposing your 15-minute temperatures are in column A, then you can run the following macro, as needed, to replicate the temperatures into 1-minute intervals in column B:

Code:
Sub CopyTemperatures()

    Dim rngTemperature As Range
    Dim lngCounter As Long
    
    lngCounter = 1
    For Each rngTemperature In Intersect(Columns("A"), ActiveSheet.UsedRange)
        Cells(lngCounter, "B").Resize(15, 1).Value = rngTemperature.Value
        lngCounter = 15 + lngCounter
    Next rngTemperature

End Sub
 
Upvote 0
.
.

Or, if you want to reference the cells using a formula, try this instead:

Code:
Sub CopyTemperatures()

    Dim rngTemperature As Range
    Dim lngCounter As Long
    
    lngCounter = 1
    For Each rngTemperature In Intersect(Columns("A"), ActiveSheet.UsedRange)
        Cells(lngCounter, "B").Resize(15, 1).Formula = "=" & rngTemperature.Address
        lngCounter = 15 + lngCounter
    Next rngTemperature
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,858
Messages
6,121,960
Members
449,057
Latest member
FreeCricketId

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
Back
Top