Function Problems

How to Flatten Date Ranges into Daily Amounts in Excel

Maira MehtabMaira Mehtab Nov 10, 2026 869 views

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.

How to Flatten Date Ranges into Daily Amounts Using Excel Dynamic Arrays
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.
Before you start

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.

Solution 1Recommended

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.

1
Select Target Cell

Click on a blank cell where you want the flattened data array to begin spilling.

2
Calculate Date Durations

Write a formula that calculates the duration for each row using the logic `(EndDate - StartDate) + 1`.

3
Generate the Sequence

Use the `SEQUENCE` function within a `LAMBDA` to generate an array of dates based on the calculated duration.

4
Distribute Amounts and Stack

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 REDUCE, VSTACK, and SEQUENCE to Flatten Data
Advanced Formulas in WPS

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. 1. Open WPS Spreadsheet: Launch WPS Office, open the file containing your date ranges, and navigate to the worksheet.
  2. 2. Input the Formula: Click on the target cell and type your dynamic array formula utilizing SEQUENCE and VSTACK.
  3. 3. Spill the Results: Press the Enter key on your keyboard to automatically spill the distributed dates and amounts down the columns.
Full compatibility with complex Microsoft Excel dynamic array formulas (.xlsx)Native support for SEQUENCE, VSTACK, and LAMBDA functionsLightweight, fast, and completely free to use
microsoft office alternative - wps office

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.