excelexcel-formula

Using average, offset & match together


I'm creating a fitness tracker with daily inputs & a weekly summary on a dashboard. My daily input data looks like this:

Date Miles Intake
01-Dec-24 11 3130
02-Dec-24 0 2730
03-Dec-24 8 2930
04-Dec-24 12 3130

And so on. I've managed to export data from Garmin Connect and it now goes back every day for years. I want the dashboard to provide a sum of mileage and an average of intake for every 7 days. For example:

Week commencing Total miles Average intake
25-Nov-24 45 3130
02-Dec-24 50 3250
09-Dec-24 35 2840
16-Dec-24 45 3130

I've been trying to use a match from the 'week commencing' column in the dashboard table to identify the first day of the week in the 'date' column/source data table. Then sum/average the 7 days from that date as necessary, and put in an offset to move the reference in the source data table down 7 rows for each row the formula moves down in the dashboard table. But no luck quite yet! I hope the information provided is enough to picture what I'm going for, but I'm happy to provide a more comprehensive example of my data & desired dashboard table if required.


Solution

  • Imagine the following data:

    enter image description here

    Columns B:D are static values from your Garmin.

    In A2:

    =DROP(TOCOL(B:B,1),1)-WEEKDAY(+DROP(TOCOL(B:B,1),1),2)+1
    

    In F2:

    =GROUPBY(A.:.A;B.:.C,HSTACK(SUM,AVERAGE),1,0)