Function Problems

How to Calculate Rolling Maximums in Excel Using Advanced Functions

Phi Hung VoPhi Hung Vo Nov 10, 2026 869 views

Question details

The user wants to evaluate rolling ranges and filter records based on local maximum values using advanced Excel functions like thunks, MAP, DROP, TAKE, and LAMBDA.

How to Calculate Rolling Maximums in Excel Using Advanced Functions
Product
Excel
Device & OS
not provided
Scenario
Calculating centered rolling windows to find local maximums, either by sequential row positions or non-sequential dates, to filter out specific records from a large dataset.
Observed behavior
Needs an efficient functional approach to process centered rolling windows and extract local maximums without exclusively relying on row positions when dates might be missing.
Before you start

Before utilizing advanced dynamic array functions, ensure your version of Excel supports modern functions like LET, LAMBDA, and FILTER. Additionally, verify whether your dataset contains continuous dates or if some are missing, as this determines whether you need a row-based or date-based window calculation.

Solution 1Recommended

Use LET and FILTER for a Row-Based Rolling Maximum

Construct a conventional array formula using the LET and FILTER functions to evaluate a centered window and retain rows that match the local maximum.

This method is highly efficient for large datasets where records are sequential and there are no missing periods. By nesting SEQUENCE and BYROW inside a LET function, you can evaluate multiple rows simultaneously without manual drag-down formulas.

1
Define the rolling window size

Start your LET function by defining the variable 'n' for your window size (e.g., n=2 for two rows before and after the current row).

2
Create evaluation sequences

Use the SEQUENCE function to generate an index of all rows in your data, and another sequence to calculate the window offsets (from -n to +n).

3
Retrieve array values

Use the INDEX function to pull the actual values from your dataset based on the combined row and offset sequences.

4
Determine the maximum value

Apply BYROW and LAMBDA to loop through each row's window array, using the MAX function to identify the highest value within that local range.

5
Filter the results

Wrap the logical condition (checking if the current row's value equals the window's maximum) inside the FILTER function to output only the records representing local maximums.

Use LET and FILTER for a Row-Based Rolling Maximum
Performance Tip: This formula method can process upwards of 100,000 elements very quickly using the modern Excel calculation engine.
Advanced Data Analysis

Use WPS Spreadsheet for Advanced Array Calculations

WPS Spreadsheet provides robust support for modern dynamic array functions, allowing you to seamlessly execute complex rolling maximum calculations and filter large datasets with ease.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open the file containing the data you want to analyze.
  2. 2. Select the target cell: Click on the top-left cell where you want the filtered rolling maximum records to spill.
  3. 3. Input the dynamic array formula: Type out your advanced formula using LET, SEQUENCE, and FILTER functions to establish the rolling window logic.
  4. 4. Execute the formula: Press Enter. WPS Spreadsheet will calculate the local maximums and dynamically spill the filtered results into the adjacent cells.
Fully compatible with modern Microsoft Excel array functions like LET, FILTER, and SEQUENCE.High-performance calculation engine for processing large datasets efficiently.Clean, intuitive interface for writing and debugging complex LAMBDA and array formulas.Free to use with comprehensive data analysis tools.
microsoft office alternative - wps office

Frequently Asked Questions

What is a rolling maximum calculation in Excel?

A rolling maximum evaluates a sliding window of data (such as a specific number of days or rows before and after a target point) to identify the highest value within that local subset. It is commonly used in time-series data analysis and financial modeling.

Why is my LAMBDA or LET function returning a #NAME? error?

The #NAME? error typically occurs if your version of Excel does not support modern dynamic array functions. LAMBDA, LET, and FILTER require a newer version like Microsoft 365, Excel 2021, or the latest version of WPS Office.

How do I handle missing dates in a rolling window calculation?

If your dataset is missing dates, do not use row-based offsets (like SEQUENCE to check the previous 2 rows). Instead, calculate the window mathematically by adding and subtracting the necessary number of calendar days directly to the target date, then filtering the dataset for values that fall within that date range.

What is the alternative to Excel formulas for massive datasets?

For extremely large datasets (e.g., millions of rows) where complex array formulas might slow down spreadsheet performance, it is recommended to use dedicated data analysis tools like Python with the pandas library, which features a highly optimized rolling().max() method for centered rolling windows.