validationgoogle-sheetsmathgoogle-sheets-formulaspreadsheet

How do I calculate the daily average of 2 different items each day, over the course of time?


I am using Google Sheets to automatically track how many times the garage doors are opened/closed through IFFFT.

Link to working spreadsheet (it can be edited): https://docs.google.com/spreadsheets/d/1zPDk8ev9uzhH2gwwpY4bJjZLeXLG-YpjnvhNhoYCxU4/edit#gid=2100307022

image

I have 'Garage door' and 'Third stall', the 2 different variables (doors) to track. I am currently calculating the total cycles in column F, but I would like to track how often each one is opened/closed every day, on average. I feel like I'm close with the :AVERAGEIF query, but I can't quite get it right.

I can't seem to figure out a formula to make sure to check the Time column and separate it out each day for each door, then create a rolling average of how many times each door is opened/closed each day.

How might I calculate each one independently with a rolling daily average in column G?

Thank you so much!


Solution

  • I have found an answer to this, and also updated the spreadsheet for future reference. The formula for the 'Garage door' daily average, column G2:

    =AVERAGE(INDEX(QUERY({$A$2:$A,INDEX(INT(SUBSTITUTE($C$2:$C,"at",)))},"SELECT Col2, COUNT(Col2) WHERE Col1 = 'Garage Door' GROUP BY Col2 LABEL COUNT(Col2) ''"),,2))