Excel times are numbers, and can be summed like other numeric values. In this example, F4:G7 is a summary table, showing the total time logged in each of three states: Standby, Run, and Offline. These values are hardcoded in the range F5:F7.
To sum time conditionally by each state, we are using the SUMIFS function in G5:
The sum_range is the named range times (C5:C15), entered in hh:mm format
Criteria_range1 is the named range states (D5:D15)
Criteria1 is entered as F5
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:
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:
To sum up hours by week and project, you can use the SUMIFS function . In the example shown, the formula in G5 is: = SUMIFS ( time , date , ">=" & $F5 , date , "<" & $F5 + 7 , project , G$4 ) where "time" (D5:D15...
If you need to add up (sum) up race time splits that are some combination of hours, minutes, and seconds, you can simply use the SUM function. The formula in cell H5 is: = SUM ( C5:G5 ) However, you must take care to enter times with the right...
To calculate the number of hours between two times, you can use a formula that simply subtracts the start time from the end time. This is useful to calculate working time, calculate elapsed time, etc. However, when times cross a day boundary (...
To calculate the total number of work hours between two dates, you can use a formula based on the NETWORKDAYS function, where "start" is the start date, "end" is the end date, "holidays" is a range that includes dates, and "hours" is the number of...
If you need to group times into buckets (i.e. group by 2 hours, group by 3 hours, etc.) you can do so with a rounding function called FLOOR. In the example shown, we have a number of transactions, each with a time stamp. Let's say you want to group...
SUMIFS is a function to sum cells that meet multiple criteria. SUMIFS can be used to sum values when adjacent cells meet criteria based on dates, numbers, and text. SUMIFS supports logical operators (>,...
Excel Formula Training
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.