How to Use a Month Value as a Dynamic SUM Range in Excel
Question details
The user wants to configure a SUM formula so that the ending row of the sum range automatically adjusts based on a specific month or date value in another cell.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Creating dynamic spreadsheets, such as budget reports, where calculations must automatically expand to include data up to a specific month without manual range adjustments.
- Observed behavior
- The user needs to implement a robust dynamic range solution, preferably using the INDEX function, to define the endpoint of the SUM based on an end-of-month date input.
Verify that your monthly data is listed in contiguous, chronologically ordered rows and note the exact row number where January begins so you can calculate your offset correctly.
Use INDEX and MONTH for a Non-Volatile Dynamic Range
Combine the SUM and INDEX functions with the MONTH function to calculate the exact ending row based on your reference date. This calculates quickly and preserves workbook performance.
Using the INDEX function to define the endpoint of a range is a highly efficient Excel technique. Because INDEX returns a cell reference when used alongside a colon (:), it perfectly forms the second half of a range. Additionally, INDEX is a non-volatile function, meaning it only recalculates when its direct precedent data changes, keeping your spreadsheet fast.
Identify the cell containing your target end-of-month date (e.g., B6) and the exact cell where your January data begins (e.g., B11).
Click the cell where you want to display the dynamic total. Type `=SUM(` followed by your starting cell and a colon, like this: `=SUM('2025 Budget'!B11:`.
After the colon, use the INDEX function to locate the correct row in the column. Type `INDEX('2025 Budget'!B:B, 10 + MONTH('2025 Budget'!B6)))`. The '10' is used because January starts on row 11 (10 rows before it).
Press Enter to execute the formula. If cell B6 contains June 30, the MONTH function returns 6. Adding 10 directs INDEX to row 16, making the final formula sum the range B11:B16 automatically.

Use the OFFSET Function as an Alternative
You can also use the OFFSET function to define the height of the range based on the month number. This is an alternative if you prefer referencing only the starting cell.
Use Dynamic Ranges Easily in WPS Spreadsheet
WPS Spreadsheet fully supports advanced array formulas, INDEX, OFFSET, and SUM functions identically to Microsoft Excel. You can build dynamic budgets and flexible reports instantly without any compatibility friction.
- 1. Open your spreadsheet file: Launch WPS Spreadsheet and open the Excel workbook containing your financial data.
- 2. Select the destination cell: Click the cell where you want your dynamic month-to-date sum to be calculated.
- 3. Enter the dynamic formula: Input `=SUM(B11:INDEX(B:B, 10+MONTH(B6)))`, adjusting the row offset and cell references to match your specific layout.
- 4. Apply and test: Press Enter to compute. Change the date in cell B6 to immediately see the SUM range automatically expand or contract.

Frequently Asked Questions
Why does my dynamic SUM formula return a #REF! error?
A #REF! error usually occurs if the row calculated by the INDEX or OFFSET function falls outside the boundaries of the worksheet (e.g., resulting in a negative row number or exceeding the sheet limit). Double-check the math adding up to your row offset (such as `10 + MONTH(B6)`) to ensure it perfectly aligns with your spreadsheet's structure.
Can I use dynamic ranges across multiple columns instead of rows?
Yes. If your months are laid out horizontally across columns, you can adjust the INDEX function to calculate the column number instead of the row number. For example, `=SUM(B11:INDEX(11:11, 1, 1+MONTH(B6)))`.
What is the primary difference between using INDEX and OFFSET for dynamic ranges?
OFFSET is considered a 'volatile' function, meaning it calculates continuously whenever any change is made anywhere in the workbook. In contrast, INDEX is non-volatile; it only recalculates when its specific precedent cells change. Using INDEX is generally better practice for maintaining performance in large files.
How do I extract a month value if my cell contains text instead of a formatted date?
If your reference cell contains the month name as text (e.g., 'June'), the standard MONTH function won't work natively. You can convert it into a month number by appending '1' to the string and wrapping it in MONTH and DATEVALUE, like this: `=MONTH(DATEVALUE(B6 & " 1"))`.




