How to Calculate an Excel Rolling Seven-Day Total by Customer
Question details
The user needs to calculate a rolling seven-day total of purchases for individual customers across a dataset containing dates, purchase amounts, and customer names.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Managing a large sales database where purchase amounts must be dynamically summed over a trailing 7-day period for specific customers.
- Observed behavior
- The user requires a multi-criteria formula that accurately aggregates a trailing 7-day sum based on both a specific date range and the customer's name, regardless of whether the dates are consecutive.
Ensure your dataset is organized into clear columns (e.g., Dates in Column A, Amounts in Column B, Customer Names in Column C) and that your date column is formatted properly as dates, not as plain text.
Use the SUMIFS Function with Date Boundaries
Calculate the rolling seven-day total by summing amounts that match the customer name and fall within the 7-day date range.
The SUMIFS function allows you to sum values based on multiple criteria. By setting one criterion to match the customer name and two additional criteria to capture dates between the current row's date and 7 days prior, you can accurately calculate a rolling total.
Click the first empty cell in your new '7-Day Total' column (e.g., cell D2) where you want the rolling total to appear.
Type the formula: =SUMIFS(B:B, C:C, C2, A:A, ">="&A2-7, A:A, "<"&A2). This assumes Column B contains amounts, Column C contains names, and Column A contains dates.
Press Enter to calculate the sum for that specific customer over the previous 7 days.
Click and drag the fill handle (the small square at the bottom-right corner of the cell) to copy the formula down through the rest of your dataset.

Calculate Rolling Total Using the Subtraction Method
Calculate the total for all dates after the trailing 7-day window and subtract any future dates.
Calculate Rolling Totals Easily with WPS Spreadsheet
WPS Spreadsheet fully supports advanced mathematical functions like SUMIFS, allowing you to seamlessly process large datasets and calculate rolling totals by customer. It provides an efficient and familiar interface for all your data analysis needs.
- 1. Open your dataset: Launch WPS Spreadsheet and open your sales or customer database.
- 2. Select the target cell: Click on the cell where you want the rolling total to be displayed.
- 3. Apply the SUMIFS formula: Type the SUMIFS formula to define your customer and dynamic date range criteria.
- 4. Fill down: Drag the fill handle down to apply the rolling calculation to the rest of the table seamlessly.

Frequently Asked Questions
What if my dates are not formatted correctly in the spreadsheet?
If dates are stored as text, the SUMIFS formula will not be able to perform calculations like 'A2-7'. Select your date column, right-click, choose 'Format Cells', and select 'Date' to ensure they are recognized properly as numerical dates.
Can I change the rolling period to 30 days instead of 7?
Yes, you can easily adjust the rolling period by changing the '7' in the formula to '30'. For example, you would use: =SUMIFS(B:B,C:C,C2,A:A,">="&A2-30,A:A,"<"&A2).
Why is my SUMIFS formula returning 0 for all customers?
This usually happens if the criteria ranges and sum ranges are not perfectly aligned, or if the customer names contain hidden spaces. Ensure your ranges (e.g., A:A, B:B, C:C) cover the exact same dimensions, and use the TRIM function if your customer names have extra spaces.




