Function Problems

How to Automatically Summarize the Most Recent Four Weeks of Data in Excel

Steve KSteve K Nov 11, 2026 869 views

Question details

The user needs to create an automatically updating summary table in Excel that compares orders and sales for the four most recent weeks as new data is added.

How to Automatically Summarize the Most Recent Four Weeks of Data in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
Creating dynamic weekly reports for sales and orders.
Observed behavior
The summary table currently requires manual updates, but needs to automatically extract and aggregate data from the last four weeks whenever new records are appended.
Before you start

Format your source data as an Official Excel Table (Ctrl + T) to ensure that your formulas automatically include new rows of data as they are added.

Solution 1Recommended

Extract the Last Four Weeks Using Dynamic Array Formulas

Best for extracting the exact rows corresponding to the four most recent weeks automatically in Excel 365.

By utilizing modern dynamic array formulas, you can extract the latest rows from your dataset without needing complex VBA macros or manual copy-pasting.

1
Format data as a Table

Select your data range and press Ctrl + T to convert it into an Excel Table. Go to the Table Design tab and name it 'WeeklyData'.

2
Use the TAKE and SORT functions

To extract the summary data directly (assuming one row per week), select the destination cell for your summary table and enter: =TAKE(SORT(WeeklyData,1,-1),4)

3
Handle multiple rows per week

If you have multiple rows per week and need to filter, use this advanced formula instead: =LET(w,UNIQUE(WeeklyData[Week]),TAKE(SORT(FILTER(WeeklyData,ISNUMBER(XMATCH(WeeklyData[Week],TAKE(SORT(w,,-1),4)))),1,-1),4))

4
Apply the formula

Press Enter to populate the dynamic array. The results will spill to adjacent cells and automatically update when new weeks are added to the 'WeeklyData' table.

Extract the Last Four Weeks Using Dynamic Array Formulas
Version Compatibility: Functions like TAKE, SORT, and LET are available in Excel 365, Excel 2021, and modern versions of WPS Office.
Dynamic Reporting

Summarize Data Automatically in WPS Spreadsheet

WPS Spreadsheet fully supports dynamic array functions like TAKE, SORT, and SUMIFS, making it incredibly easy to build automated rolling reports for your business without paying expensive subscriptions.

  1. 1. Open your data: Launch WPS Spreadsheet and open your existing .xlsx report.
  2. 2. Format as Table: Highlight your data and use the 'Format as Table' option in the Home tab to make it dynamic.
  3. 3. Apply dynamic formulas: Enter =TAKE(SORT(WeeklyData,1,-1),4) in your summary area to instantly extract your latest 4 weeks of data.
  4. 4. Save your automated report: Save your document. The report will now automatically update as new weekly data is entered.
Fully compatible with Microsoft Excel formulas and .xlsx formatsSupports dynamic arrays (TAKE, SORT, UNIQUE, FILTER) nativelyLightweight, fast, and easy to use for data analysisFree powerful data manipulation tools
microsoft office alternative - wps office

Frequently Asked Questions

Why is the TAKE function returning a '#NAME?' error?

The '#NAME?' error occurs if your version of Excel does not support the TAKE function. This function is available in Microsoft 365, Excel 2021, and newer versions like WPS Office. If you are using an older version, you'll need to use OFFSET or INDEX combined with MATCH.

How does the MAX function help in the SUMIFS formula?

The MAX function finds the highest value (the most recent date or week number) in your 'Week' column. By subtracting 21 days from this maximum date, the SUMIFS formula creates a rolling 4-week window that automatically advances when new data is added.

Do I have to use an Excel Table for this to work?

While not strictly mandatory, formatting your data as an Excel Table (Ctrl + T) is highly recommended. It creates structured references (like 'WeeklyData[Sales]') that automatically expand to include new rows, ensuring your formulas never miss new data.

Can I adjust the formula to summarize the last 8 weeks instead?

Yes. In the TAKE formula, change the number 4 at the end to 8 (e.g., =TAKE(SORT(WeeklyData,1,-1),8)). For the SUMIFS formula, change the -21 days to -49 days (7 previous weeks + current week).