11.11 Group by interval of data values

 

Here below is a data table:

imagepng

The task is to put every 5 days in a group, and calculate the average of the values in each group:

A
1 =E(‘A1:B19’)
2 =A1.Date
3 =A1.group@i(if(Date-A2==5,(A2=Date,true),false))
4 =A3.new(Date,~.avg(Value):Avg)

imagepng

A2: Let the start variable of loop be the Date of the first row.
A3: Put every 5 days in a group.
A4: Calculate the average of the values in each group, and the Date means the first date of each group.


https://c.scudata.com/article/1651916536524
https://c.scudata.com/article/1657157948145
https://c.scudata.com/article/1657247950044