Calculation Issues

How to Calculate an Excel Rolling Seven-Day Total by Customer

Khadija KhanKhadija Khan Nov 3, 2026 871 views

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.

How to Calculate an Excel Rolling Seven-Day Total by Customer
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the target cell

Click the first empty cell in your new '7-Day Total' column (e.g., cell D2) where you want the rolling total to appear.

2
Enter the SUMIFS formula

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.

3
Apply the calculation

Press Enter to calculate the sum for that specific customer over the previous 7 days.

4
Fill the formula down

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.

Use the SUMIFS Function with Date Boundaries
Handling Non-Consecutive Dates: This formula functions perfectly even if a customer doesn't make a purchase every day, as it evaluates the mathematical date values rather than just counting rows.
Data Analysis Solution

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. 1. Open your dataset: Launch WPS Spreadsheet and open your sales or customer database.
  2. 2. Select the target cell: Click on the cell where you want the rolling total to be displayed.
  3. 3. Apply the SUMIFS formula: Type the SUMIFS formula to define your customer and dynamic date range criteria.
  4. 4. Fill down: Drag the fill handle down to apply the rolling calculation to the rest of the table seamlessly.
Fully compatible with Microsoft Excel formulas including SUMIFS and COUNTIFS.Handles thousands of rows smoothly without lagging or freezing.Free and lightweight data analysis tool for complex calculations.Familiar user interface requiring no learning curve.
microsoft office alternative - wps office

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.