Group Consecutive Dates and Sum Billing Hours in Excel
Question details
Group consecutive billing dates into date ranges and total the hours and amounts for each range.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A billing sheet contains service dates, hours, and amounts that need to be summarized by consecutive date range.
- Observed behavior
- The desired result is one row per consecutive date group, showing its start date, end date, total hours, and total amount.
Place service dates in column A, hours in column B, and amounts in column C, with headers in row 1. Ensure service dates are real Excel dates without time values and hours and amounts are numeric.
Automatically group consecutive dates in Microsoft 365 Excel
Use a dynamic-array formula to identify date groups and calculate their billing totals automatically.
This formula requires a version of Excel that supports LET, FILTER, SORT, UNIQUE, DROP, VSTACK, HSTACK, MAP, and LAMBDA. Duplicate dates are included in the same group, and consecutive dates across a month boundary remain in the same group.
Enter Date From, Date To, Hours, and Amount in cells E1:H1. Make sure the cells below those headers are empty so the results can spill.
In E2, enter =LET(d,SORT(UNIQUE(FILTER(A2:A1000,ISNUMBER(A2:A1000)))),s,IF(ROWS(d)=1,d,FILTER(d,VSTACK(TRUE,DROP(d,1)-DROP(d,-1)>1))),e,IF(ROWS(d)=1,d,FILTER(d,VSTACK(DROP(d,1)-DROP(d,-1)>1,TRUE))),h,MAP(s,e,LAMBDA(x,y,SUMIFS(B2:B1000,A2:A1000,">="&x,A2:A1000,"<="&y))),a,MAP(s,e,LAMBDA(x,y,SUMIFS(C2:C1000,A2:A1000,">="&x,A2:A1000,"<="&y))),HSTACK(s,e,h,a)).
Select columns E and F and choose Home > Number Format > Short Date. Check the spilled totals against your source records.

Sum hours and amounts for entered date ranges
Use SUMIFS when you can enter the start and end dates yourself or do not have the required dynamic-array functions.
Total billing hours and amounts by date range in WPS
Open your billing workbook in WPS Spreadsheets and use SUMIFS to calculate hours and amounts for each start and end date you enter.
- 1. Open the billing workbook: In WPS Spreadsheets, select Open and choose the Excel workbook containing dates in column A, hours in column B, and amounts in column C.
- 2. Enter the date ranges: Add Date From and Date To headers in E1 and F1, then enter each group's start and end dates below them.
- 3. Calculate hours and amounts: Enter =SUMIFS($B$2:$B$1000,$A$2:$A$1000,">="&E2,$A$2:$A$1000,"<="&F2) in G2. In H2, enter =SUMIFS($C$2:$C$1000,$A$2:$A$1000,">="&E2,$A$2:$A$1000,"<="&F2).
- 4. Fill and save: Copy G2:H2 down alongside your other date ranges, check the totals, and select Save or Save As to save the workbook.

Frequently Asked Questions
What counts as a consecutive date group?
A group contains dates with no missing calendar day between them. For example, May 1 and May 2 form one group, while May 4 starts another. Multiple records on the same date are included in the same group.
Why does the dynamic-array formula show a spill error?
Check that the output area starting at E2 is empty, then clear any cells blocking the results. Also confirm that your Excel version supports the dynamic-array functions used in the formula.
Can I use the date-range formulas in an older version of Excel?
Yes. Enter the start and end dates in columns E and F, then use the SUMIFS formulas in columns G and H. Unlike the dynamic-array formula, this method does not find the groups automatically.
Will consecutive dates at the end of one month and the start of the next be grouped together?
Yes. The automatic formula groups dates by calendar-day continuity, not by month. To keep months separate, limit the source data to the month you want to summarize.




