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
 
You only supplied one date's values, however, this Mcode should do what you want. This is a Power Query Solution.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Time", type date}}),
    #"Split Column by Position" = Table.SplitColumn(#"Changed Type", "External data", Splitter.SplitTextByPositions({0, 5}, false), {"External data.1", "External data.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position",{{"External data.1", type number}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"External data.2"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Time"}, {{"Average", each List.Average([External data.1]), type nullable number}})
in
    #"Grouped Rows"
 
Upvote 0
You only supplied one date's values, however, this Mcode should do what you want. This is a Power Query Solution.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Time", type date}}),
    #"Split Column by Position" = Table.SplitColumn(#"Changed Type", "External data", Splitter.SplitTextByPositions({0, 5}, false), {"External data.1", "External data.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Position",{{"External data.1", type number}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"External data.2"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Time"}, {{"Average", each List.Average([External data.1]), type nullable number}})
in
    #"Grouped Rows"
Hi,

It would not allow me to add everything in the mini XL2BB sheet, as it can only upload so much and as you can see, this data is expansive. I have not used Power Query before, is there anything I should know?

Many thanks for your time
 
Upvote 0
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
Perfect, thank you.

One last thing, what should I refer to as my Excel table so that it goes to the right thing? At the moment when I try and run the code it says that I cannot do it. What is the name?
 
Upvote 0
I added 2 numbers for another date
If your version of Excel has Groupby try that suggestion.

T202503a.xlsm
ABCD
1TimeExternal data
2452958.703 °C452957.68250413
345295.003478.743 °C4529611.825
445295.006948.676 °CTotal7.74986179
545295.010428.664 °C
645295.013898.743 °C4-Jan-247.68250413
745295.017368.673 °C5-Jan-2411.825
845295.020838.596 °C
2d
Cell Formulas
RangeFormula
C2:D4C2=GROUPBY(INT(A2:A124),--LEFT(B2:B124,5),AVERAGE)
D6:D7D6=SUM(LEFT($B$2:$B$124,5)*(INT($A$2:$A$124)=G6))/SUM(--(INT($A$2:$A$124)=G6))
Dynamic array formulas.




T202503a.xlsm
CD
1DateTemperature
24-Jan-248.703
34-Jan-248.743
2dd
Cell Formulas
RangeFormula
C2:C3C2=INT(A2)
D2:D3D2=--LEFT(B2,5)
 
Last edited:
Upvote 0
I added 2 numbers for another date
If your version of Excel has Groupby try that suggestion.

T202503a.xlsm
ABCD
1TimeExternal data
2452958.703 °C452957.68250413
345295.003478.743 °C4529611.825
445295.006948.676 °CTotal7.74986179
545295.010428.664 °C
645295.013898.743 °C4-Jan-247.68250413
745295.017368.673 °C5-Jan-2411.825
845295.020838.596 °C
2d
Cell Formulas
RangeFormula
C2:D4C2=GROUPBY(INT(A2:A124),--LEFT(B2:B124,5),AVERAGE)
D6:D7D6=SUM(LEFT($B$2:$B$124,5)*(INT($A$2:$A$124)=G6))/SUM(--(INT($A$2:$A$124)=G6))
Dynamic array formulas.




T202503a.xlsm
CD
1DateTemperature
24-Jan-248.703
34-Jan-248.743
2dd
Cell Formulas
RangeFormula
C2:C3C2=INT(A2)
D2:D3D2=--LEFT(B2,5)
Hi there,

This works but I have multiple days to do this on, and it is time consuming to scroll up and down to find the cell number for the starting and end point of each day. What should I do to speed up this process?
 
Upvote 0
With the new columns such as C and D that I show above, you can use Excel's built-in feature to provide the Average.

I show just option 1 of the information that is provided by Data|Subtotal
N.B. Excel provides the formulas; do not manually enter formulas.


T202503a.xlsm
CD
1DateTemperature
1234-Jan-247.68250413
1265-Jan-2411.825
127Grand Average7.74986179
128
2dd
Cell Formulas
RangeFormula
D123D123=SUBTOTAL(1,D2:D122)
D126D126=SUBTOTAL(1,D124:D125)
D127D127=SUBTOTAL(1,D2:D125)
 
Upvote 0
Just list the relevant dates.
- list the required dates or
- prepare a unique list of dates

What data do you have and what type of summary do you require?

Does Excel 2024 have Groupby?
 
Upvote 0
With the new columns such as C and D that I show above, you can use Excel's built-in feature to provide the Average.

I show just option 1 of the information that is provided by Data|Subtotal
N.B. Excel provides the formulas; do not manually enter formulas.


T202503a.xlsm
CD
1DateTemperature
1234-Jan-247.68250413
1265-Jan-2411.825
127Grand Average7.74986179
128
2dd
Cell Formulas
RangeFormula
D123D123=SUBTOTAL(1,D2:D122)
D126D126=SUBTOTAL(1,D124:D125)
D127D127=SUBTOTAL(1,D2:D125)
Hi David,

I think I have confused this a touch. The data that I uploaded was just a fraction of the temperatures that were available for that one day. I could not add all of them as there was a restriction on the amount of data that I could upload. Anyway, the data continues for the rest of that day, then the next, and the next and so on. What I need is to calculate the average temperature for each individual day. So, for example, the average temperature for each data point from 00:00 hours on 31/03/2024 until 23:55 hours 31/03/2024, and then the same for the next day, and the next. I hope this makes sense, as I am not sure that code does exactly what I am after.
 
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