where times (C5:C15), and states (D5:D15) are named ranges. To sum time conditionally by each state, we are using the SUMIFS function in G5: The reference to F5 is relative. When the formula is copied down the column, F5 changes at each new row. The two named ranges, times and states, are are fixed and do not change. In each row, SUMIFS correctly shows the total hours logged for a given state. Note when time exceeds 24 hours, you will need to use a custom time format as explained below.

Durations over 24 hours

With normal time formats like hh:mm, hours will “reset” to zero each 24 hours. This makes sense when the intent is to display an actual time, but it can be confusing when the total time exceeds 1 day, because hours appear to be lost. To display time durations of more than 24 hours use a custom number format with hours in square brackets, as shown below: For a more detailed explanation, see Sum time in Excel.

Without names ranges

The named ranges in this formula are used for convenience only. Named ranges are automatically absolute, so there is no need to lock references manually. However, the named ranges are entirely optional. Without named ranges, the equivalent formula is:

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.