Separating dates by adding rows, followed by formulas in the rows

Sumeetmohanty

New Member
Joined
Jul 10, 2018
Messages
1
I have a weather dataset of over 5000 entries. The entries have hourly recorded values for each day from 20th-Jan-2006 to 31st-Aug-2006.
I have to separate every day by inserting three rows and in those rows i want three formulas which calculate avg, min, max for of the different parameters of that particular day.
Any help would be really appreciated.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
sounds a bit mad for me, because now you have nicely ordered database and after action you will get some mixed presentation. But may be it is a form needed for other programm or spreadsheet, so let's try.

See sample VBA code (it assumes in row1 there are headers and you want 3 rows after each row. I'm not sure if it's the case, but you've shown no sample data layout :-( ):
Code:
Sub test()
Dim i As Long, oldcalcmode As Long
oldcalcmode = Application.Calculation
Application.Calculation = xlCalculationManual
For i = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
  Rows(i + 1 & ":" & i + 3).Insert
  Cells(i + 1, "F").FormulaR1C1 = "=AVERAGE(R[-1]C[1]:R[-1]C[5])"
  Cells(i + 2, "F").FormulaR1C1 = "=AVERAGE(R[-2]C[1]:R[-2]C[3])" 'note row [-2] for second added row
Next i
Application.Calculation = oldcalcmode
Application.Calculate
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,147
Members
453,021
Latest member
Justyna P

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