Calculate Daily and Seven-Day Glucose Averages in Excel Tables
Question details
Calculate daily and rolling seven-day glucose averages using Excel table references.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user records glucose readings by date in an Excel table and wants daily and seven-day averages.
- Observed behavior
- A leading space in the Glucose column header can cause a structured-reference formula to fail or refer to the wrong field.
Check that the Date column contains real Excel dates and the Glucose column contains numeric readings. Select the Glucose header and check the formula bar for leading spaces; the formulas below assume date-only values.
Calculate daily and rolling seven-day averages with table formulas
Use these formulas when your table has Date and Glucose columns and you want each row to show its date's averages.
Select the Glucose header. If it contains a leading space, remove the space and press Enter, or use the exact header spelling in each structured reference.
Add a Daily Average column to the table and enter =AVERAGEIF([Date],[@Date],[Glucose]). If the header is exactly " Glucose" with a leading space, use =AVERAGEIF([Date],[@Date],[[ Glucose]]) instead.
Add a Seven-Day Average column and enter =AVERAGEIFS([Glucose],[Date],">="&[@Date]-6,[Date],"<"&[@Date]+1). This averages readings from the current date and the preceding six calendar dates, regardless of table sort order.
If you kept the leading space in the Glucose header, replace [Glucose] in the seven-day formula with [[ Glucose]]: =AVERAGEIFS([[ Glucose]],[Date],">="&[@Date]-6,[Date],"<"&[@Date]+1).

Calculate glucose averages in WPS Spreadsheet
Open your workbook in WPS Spreadsheet and use AVERAGEIFS with cell ranges to calculate daily and rolling seven-day glucose averages.
- 1. Open the workbook: In WPS Spreadsheet, choose Open and select your Excel workbook.
- 2. Check the data columns: Confirm that column A contains dates and column B contains numeric glucose readings, with headers in row 1. Adjust the ranges below if your data is in different columns or extends beyond row 1000.
- 3. Calculate the daily average: In C2, enter =AVERAGEIFS($B$2:$B$1000,$A$2:$A$1000,">="&INT(A2),$A$2:$A$1000,"<"&INT(A2)+1).
- 4. Calculate the seven-day average: In D2, enter =AVERAGEIFS($B$2:$B$1000,$A$2:$A$1000,">="&INT(A2)-6,$A$2:$A$1000,"<"&INT(A2)+1).
- 5. Fill down and save: Select C2:D2 and drag the fill handle down alongside your readings. Use File > Save As to save the workbook in XLSX format.

Frequently Asked Questions
Why does my Glucose structured reference fail?
Select the table header and check for a leading space. Rename " Glucose" to "Glucose", or reference the exact header as [[ Glucose]] in your formula.
Does the seven-day formula require the table to be sorted?
No. AVERAGEIFS checks the Date column against the date boundaries, so the rows can be in ascending or descending order.
Does the rolling average include today and seven previous days?
No. The formula uses the current row's date and the preceding six calendar dates, for a total of seven calendar dates.
What if my Date column includes times?
For a daily average in Excel, use =AVERAGEIFS([Glucose],[Date],">="&INT([@Date]),[Date],"<"&INT([@Date])+1). For a seven-day average, use =AVERAGEIFS([Glucose],[Date],">="&INT([@Date])-6,[Date],"<"&INT([@Date])+1). Adjust the Glucose reference if its header contains a leading space.
How can I keep a chart updated when I add readings?
Select the relevant table columns and use Insert > Chart to create a table-based chart. Alternatively, check the chart's source range under Chart Design > Select Data and set it to the range you want to plot.




