How to Flatten Date Ranges into Daily Amounts in Excel
Question details
The user needs to distribute total amounts evenly across a date range, transforming start dates and end dates into a single row for each day.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Transforming summarized data containing start dates, end dates, and total amounts into a granular daily dataset with evenly prorated amounts.
- Observed behavior
- The current data is summarized by date range. The goal is to output a flattened list where each date has its own row and corresponding distributed amount, and overlapping ranges are summed.
Ensure you are using a version of Excel (such as Microsoft 365 or Office 2021) that natively supports dynamic array functions like LAMBDA, SEQUENCE, and VSTACK.
Use REDUCE, VSTACK, and SEQUENCE to Flatten Data
This method iterates through the rows, calculates daily amounts, and stacks them into a single comprehensive table.
Because mapping functions like MAP and SCAN expect scalar values at each step, generating an array of dates directly inside MAP will return a #CALC! error. Using REDUCE alongside VSTACK bypasses this limitation.
Click on a blank cell where you want the flattened data array to begin spilling.
Write a formula that calculates the duration for each row using the logic `(EndDate - StartDate) + 1`.
Use the `SEQUENCE` function within a `LAMBDA` to generate an array of dates based on the calculated duration.
Divide the row's total amount by its duration, and wrap the operation in `REDUCE` and `VSTACK` to combine the daily arrays. Press Enter to spill the results.

Use a Custom LAMBDA and GROUPBY for Overlapping Ranges
When your source data contains overlapping date ranges, use this method to distribute the amounts and sum them up by date.
Implement a Recursive LAMBDA Function
For smaller tables (under 2,000 rows), a recursive LAMBDA can process each row and recursively append the distributed dates and amounts.
Easily Flatten Data Ranges Using Dynamic Arrays in WPS Office
WPS Office Spreadsheet provides full, native support for advanced dynamic array functions like SEQUENCE, VSTACK, and LAMBDA, making complex data transformations straightforward and free.
- 1. Open WPS Spreadsheet: Launch WPS Office, open the file containing your date ranges, and navigate to the worksheet.
- 2. Input the Formula: Click on the target cell and type your dynamic array formula utilizing SEQUENCE and VSTACK.
- 3. Spill the Results: Press the Enter key on your keyboard to automatically spill the distributed dates and amounts down the columns.

Frequently Asked Questions
Why do I get a #CALC! error when trying to return an array in MAP?
Excel's MAP and SCAN functions expect a single scalar value to be returned for each iteration. If your LAMBDA attempts to return an array (like a sequence of dates) at each step, Excel throws a #CALC! error. Using REDUCE combined with VSTACK resolves this.
How do I handle overlapping date ranges when flattening data?
After generating the daily rows and prorated amounts, wrap your final array logic in the GROUPBY function. By grouping identical dates and using the SUM aggregation, you combine the distributed amounts into accurate daily totals.
What is the recursion limit for custom LAMBDA functions in Excel?
Excel limits recursive LAMBDA functions to processing approximately 2,047 iterations. For very large datasets, iterative approaches using REDUCE and VSTACK are much faster and avoid hitting this recursion limit.




