Function Problems

Group Consecutive Dates and Sum Billing Hours in Excel

Bushra ParveenBushra Parveen Nov 18, 2026 868 views

Question details

Group consecutive billing dates into date ranges and total the hours and amounts for each range.

Group Consecutive Dates and Sum Billing Hours in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Add output headers

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.

2
Enter the grouping formula

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)).

3
Format and check the results

Select columns E and F and choose Home > Number Format > Short Date. Check the spilled totals against your source records.

Automatically group consecutive dates in Microsoft 365 Excel
Adjust the source ranges: The formula expects at least one valid date in A2:A1000. If your data extends beyond row 1000, increase the last row in every source range. To summarize a single month separately, limit the source data to that month.
Summarize billing in WPS Spreadsheets

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. 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. 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. 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. 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.
Calculate billing totals for inclusive date ranges with SUMIFSOpen and edit Microsoft Excel XLSX workbooksUse a familiar spreadsheet interfaceWork with a free, easy-to-use office suite
microsoft office alternative - wps office

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.