10 min interval data to 5 min

NovaKZM

New Member
Joined
Dec 16, 2022
Messages
2
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
Platform
  1. Windows
  2. Web
Hi there, I have excel files with 10 min interval data rows, now I wanna conversion it to 5 min data, time 5 min, other columns copy.
Did anyone do the same thing?
Is there any idea to help me pls?
Ive seen some body do it with macron excel but my files are huge, cannot do and record what Im doing in a macro.
Could you pls help?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
welcome to the forum, I assume you want to interpolate between the 10 min values by using the average of the 10 min values. You haven't said which columns you want interpolating but hopefully this code will help you on your way: It doeas all the column and assumes they are all numeric
VBA Code:
Sub test()
Dim outarr()
With Worksheets("Sheet1")
lastcol = .Cells(1, .Columns.Count).End(xlToLeft).Column
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
inarr = .Range(.Cells(1, 1), .Cells(lastrow, lastcol))
ReDim outarr(1 To lastrow * 2, 1 To lastcol)
For i = 2 To lastrow - 1
  For j = 1 To lastcol
   outarr((i - 1) * 2, j) = inarr(i, j)
   outarr(1 + (i - 1) * 2, j) = (inarr(i, j) + inarr(i + 1, j)) / 2
  Next j
Next i
  For j = 1 To lastcol
   outarr(lastrow * 2 - 2, j) = inarr(lastrow, j)
  Next j
End With
Worksheets.Add
Range(Cells(1, 1), Cells(lastrow * 2, lastcol)) = outarr

 
End Sub
 
Upvote 0
welcome to the forum, I assume you want to interpolate between the 10 min values by using the average of the 10 min values. You haven't said which columns you want interpolating but hopefully this code will help you on your way: It doeas all the column and assumes they are all numeric
VBA Code:
Sub test()
Dim outarr()
With Worksheets("Sheet1")
lastcol = .Cells(1, .Columns.Count).End(xlToLeft).Column
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
inarr = .Range(.Cells(1, 1), .Cells(lastrow, lastcol))
ReDim outarr(1 To lastrow * 2, 1 To lastcol)
For i = 2 To lastrow - 1
  For j = 1 To lastcol
   outarr((i - 1) * 2, j) = inarr(i, j)
   outarr(1 + (i - 1) * 2, j) = (inarr(i, j) + inarr(i + 1, j)) / 2
  Next j
Next i
  For j = 1 To lastcol
   outarr(lastrow * 2 - 2, j) = inarr(lastrow, j)
  Next j
End With
Worksheets.Add
Range(Cells(1, 1), Cells(lastrow * 2, lastcol)) = outarr

 
End Sub
Thanks for that, I will check and let you know mate. Yes first column date/ time and other are numberic.
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,664
Members
449,045
Latest member
Marcus05

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