Averaging Data Set

ZochSteveo

New Member
Joined
Dec 21, 2024
Messages
30
Office Version
  1. 2024
Platform
  1. MacOS
Hi there,

So I have a list of times at intervals of every 5 minutes for about 7 months or so. For each 5 minute interval, there is a corresponding value for the temperature as well. I need to average the values for all recordings of the temperature for each respective day. Is there a fast way of me being able to do this?

The times are as follows for example: 04/01/2024 00:00, 04/01/2024 00:05, 04/01/2024 00:10 etc. and for each time stamp there is a corresponding temperature value. I need to average each temperature value for the whole day, and do this for every day in which there are around 7 months worth,

Practice Analysis.xlsx
AB
3TimeExternal data
41/4/24 0:008.703 °C
51/4/24 0:058.743 °C
61/4/24 0:108.676 °C
71/4/24 0:158.664 °C
81/4/24 0:208.743 °C
91/4/24 0:258.673 °C
101/4/24 0:308.596 °C
111/4/24 0:358.569 °C
121/4/24 0:408.586 °C
131/4/24 0:458.637 °C
141/4/24 0:508.595 °C
151/4/24 0:558.499 °C
161/4/24 1:008.340 °C
171/4/24 1:058.421 °C
181/4/24 1:108.341 °C
191/4/24 1:158.353 °C
201/4/24 1:208.191 °C
211/4/24 1:258.272 °C
221/4/24 1:308.090 °C
231/4/24 1:358.115 °C
241/4/24 1:408.017 °C
251/4/24 1:458.082 °C
261/4/24 1:507.971 °C
271/4/24 1:557.924 °C
281/4/24 2:007.880 °C
291/4/24 2:057.918 °C
301/4/24 2:107.913 °C
311/4/24 2:157.835 °C
321/4/24 2:207.916 °C
331/4/24 2:257.755 °C
341/4/24 2:307.925 °C
351/4/24 2:357.922 °C
361/4/24 2:407.925 °C
371/4/24 2:457.980 °C
381/4/24 2:508.001 °C
391/4/24 2:557.958 °C
401/4/24 3:007.989 °C
411/4/24 3:057.960 °C
421/4/24 3:107.987 °C
431/4/24 3:158.070 °C
441/4/24 3:208.032 °C
451/4/24 3:258.014 °C
461/4/24 3:307.933 °C
471/4/24 3:358.032 °C
481/4/24 3:407.961 °C
491/4/24 3:457.978 °C
501/4/24 3:507.913 °C
511/4/24 3:557.826 °C
521/4/24 4:007.735 °C
531/4/24 4:057.623 °C
541/4/24 4:107.535 °C
551/4/24 4:157.411 °C
561/4/24 4:207.298 °C
571/4/24 4:257.244 °C
581/4/24 4:307.142 °C
591/4/24 4:356.968 °C
601/4/24 4:406.842 °C
611/4/24 4:456.744 °C
621/4/24 4:506.770 °C
631/4/24 4:556.764 °C
641/4/24 5:006.715 °C
651/4/24 5:056.554 °C
661/4/24 5:106.569 °C
671/4/24 5:156.602 °C
681/4/24 5:206.488 °C
691/4/24 5:256.346 °C
701/4/24 5:306.369 °C
711/4/24 5:356.246 °C
721/4/24 5:406.149 °C
731/4/24 5:455.969 °C
741/4/24 5:506.063 °C
751/4/24 5:555.829 °C
761/4/24 6:005.838 °C
771/4/24 6:055.836 °C
781/4/24 6:105.507 °C
791/4/24 6:155.703 °C
801/4/24 6:205.620 °C
811/4/24 6:255.879 °C
821/4/24 6:305.696 °C
831/4/24 6:355.598 °C
841/4/24 6:405.640 °C
851/4/24 6:455.683 °C
861/4/24 6:505.773 °C
871/4/24 6:555.645 °C
881/4/24 7:005.612 °C
891/4/24 7:055.580 °C
901/4/24 7:105.706 °C
911/4/24 7:155.972 °C
921/4/24 7:206.006 °C
931/4/24 7:256.137 °C
941/4/24 7:306.129 °C
951/4/24 7:356.266 °C
961/4/24 7:406.430 °C
971/4/24 7:456.545 °C
981/4/24 7:506.936 °C
991/4/24 7:557.210 °C
1001/4/24 8:007.282 °C
1011/4/24 8:057.429 °C
1021/4/24 8:107.500 °C
1031/4/24 8:157.636 °C
1041/4/24 8:207.747 °C
1051/4/24 8:258.145 °C
1061/4/24 8:308.344 °C
1071/4/24 8:358.433 °C
1081/4/24 8:408.554 °C
1091/4/24 8:458.763 °C
1101/4/24 8:508.875 °C
1111/4/24 8:559.089 °C
1121/4/24 9:009.266 °C
1131/4/24 9:059.658 °C
1141/4/24 9:109.579 °C
1151/4/24 9:159.749 °C
1161/4/24 9:209.764 °C
1171/4/24 9:259.884 °C
1181/4/24 9:3010.028 °C
1191/4/24 9:3510.180 °C
1201/4/24 9:4010.855 °C
1211/4/24 9:4510.938 °C
1221/4/24 9:5010.917 °C
1231/4/24 9:5511.600 °C
1241/4/24 10:0012.050 °C
Sheet1
 
How is your data in the column holding 7.66677 formatted in Power Query? Decimal? Text? Something else? In the Mcode I provided, I changed the format to a Decimal. Did you? Did you modify the Mcode I provided?
I copied and pasted the code straight into power query exactly as you sent to me on here
 
Upvote 0
Here is my code in a file with your numbers. I do not get the same error message, so it leaves me to believe that either your actual file is not represented as shown or there is a difference in your Mcode versus mine.

 
Upvote 0
Here is my code in a file with your numbers. I do not get the same error message, so it leaves me to believe that either your actual file is not represented as shown or there is a difference in your Mcode versus mine.

The only idea I have is that the code that I supplied in the file was only a snapshot; it was not the expansive file. There was not enough space in the file to actually demonstrate everything that was going on, as there are thousands of data points. The file carries on from where I cut it off, as it is a continuous recording of the temperature for many, many days.
 
Upvote 0
"
The file carries on from where I cut it off, as it is a continuous recording of the temperature for many, many days."

If you use a current version of Excel 365, the suggestions in post #14 should both work for you. Did you try them?

You also have several formula suggestions that are applicable to earlier versions of Excel.
 
Last edited:
Upvote 0
The only idea I have is that the code that I supplied in the file was only a snapshot; it was not the expansive file. There was not enough space in the file to actually demonstrate everything that was going on, as there are thousands of data points. The file carries on from where I cut it off, as it is a continuous recording of the temperature for many, many days.
Post your file in a third party location so that we can see the entire issue and see if we can fix it. Use Box.Net or Dropbox.com or similar cloud. Post the link here.
 
Upvote 0
Is your column of dates&times actual dates+time? Can you format the dates and times with custom format ? Ensure that they are values and not text.

Can you convert the range to real dates and times?


You can try our formulas on a clean sheet.
Click on the icon below the f(x) in the heading and paste in your sheet.
 
Upvote 0
Edit to formulas
If you want to enter the full ranges for the data, edit the ranges shown,

The last two sets of formulas consider the full ranges of data that you have in Columns A and B.
The * 1 coerces the text to values; this assumes that there are no extraneous characters.

T202503a.xlsm
CDEFGH
20
214-Jan-247.682736
225-Jan-2411.825
23
24
254-Jan-247.682736
265-Jan-2411.825
27
28
29
30 AVERAGECOUNTMAXMIN
314-Jan-247.68273612112.055.507
325-Jan-2411.825212.0511.6
33
2d
Cell Formulas
RangeFormula
C21:D22C21=LET(d,INT(A1:A124*1),t,--LEFT(B1:B124,LEN(B1:B124)-3),GROUPBY(d,t,AVERAGE,1,0))
C25:D26C25=LET(d,INT(A.:.A*1),t,--LEFT(B.:.B,LEN(B.:.B)-3),GROUPBY(d,t,AVERAGE,1,0))
C30:G32C30=LET(d,INT(A.:.A*1),t,--LEFT(B.:.B,LEN(B.:.B)-3),GROUPBY(d,t,HSTACK(AVERAGE,COUNT,MAX,MIN),1,0))
Dynamic array formulas.
 
Upvote 0
With large and continuously updated and growing data, I believe that using VBA is a suitable solution for you.
Try this code:
VBA Code:
Option Explicit
Sub test()
Dim lr&, i&, rng, dat As Double
Dim dic As Object
Set dic = CreateObject("Scripting.Dictionary")
lr = Cells(Rows.Count, "A").End(xlUp).Row ' last used row in column A
rng = Range("A2:B" & lr).Value ' data range
For i = 1 To UBound(rng)
    dat = Int(rng(i, 1)) ' get date
    If Not dic.exists(dat) Then ' new date found
        dic.Add dat, i ' store new date and row index
    Else  'last row of date found, then average from "00:00" till "23:55"
        If Format(rng(i, 1) - dat, "hh:mm") = "23:55" Then dic(dat) = WorksheetFunction.Average(Range("B" & dic(dat) & ":" & "B" & i + 1))
    End If
Next
' if result is in column D: E, from D2
With Range("D2")
    .Resize(1000000, 2).ClearContents ' clear old value
    .Resize(dic.Count, 2).Value = WorksheetFunction.Transpose(Array(dic.keys, dic.items)) ' paste new results
End With
End Sub

And here is the file attached
 
Upvote 0

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