
Now we see that Richard worked 3 hours and 45 minutes. In the Type list, click h:mm (for hours and minutes), and then click OK. In the Format Cells box, click Custom in the Category list. In cell D2, subtract the end time from the start time by entering the formula =C2-B2, and then press Enter. Type the other start and end times for your friends, Joy and Leslie. In cell C2, enter the end time, including “ a” or “ p” as appropriate, and then press Enter. In cell B2, enter the start time and include “ a” for AM or “ p” for PM. Here's another example: Let's say that you and your friends know both your start and end times at a volunteer project, and want to know how much time you spent in total.įollow these steps to get the elapsed time-which is the difference between two times. The format will be in the Type list the next time you need it. Take note of the colon after and a semicolon after mm. In the Type box, at the top of the list of formats, type and then choose OK.

In the Format Cells box, choose Custom in the Category list. On the Home tab, in the Cells group, choose Format, and then choose Format Cells. To display the time as more than 24 hours, select cell B4. This is because the time for Task 2 is in 24-hour time. The result is 4:15, which is not what you might expect. Type =B2+B3 in cell B4, and then press Enter. In cell B2 type 12:45, and in cell B3 type 15:30. You need to apply a special format to the formula result. Well, that was easy enough, but there’s an extra step if your hours add up to more than 24. Press Enter to get the same result, 16 hours and 15 minutes. The formula will look like this: =SUM(B2:B3). Select cell B4, and then on the Home tab, choose AutoSum. I can modify this if you need a different behavior depending on which columns are empty.Tip: You can also add up times by using the AutoSum function to sum numbers. This will return 0 if both fields are empty, C if only B is empty and -B if only C is empty.

In RESULTS, use the following formula (put this one in row number 1 and copy it down): =VLOOKUP(A1,DATA!A:C,3,FALSE)-VLOOKUP(A1,DATA!A:C,2,FALSE) If I didn't understand your question correctly, feel free to comment and clarify and I will propose something else.Įdit for VLOOKUP solution: I'm assuming that the client IDs are in column A in both tabs and you have to substract B from C in the same row as the ID in the DATA tab. If one of the two columns is empty, it won't do anything, which is what you want. The IF condition checks if both DATA!B1 and DATA!A1 are not empty, in which case it means they both have data and it will substract it. In the results tab, you could just type =IF(AND(DATA!B1"",DATA!A1""),DATA!B1-DATA!A1,"")Īnd copy the formula down the whole column. I don't actually get why you need to use VLOOKUP to substract two columns.
