adding time issue

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I am trying to add time but it does not work. Please see the excel file in the link.

in cell P = SUM(C15:O15)

But it is giving me 0

I tried to format to [h]:mm but did not help. Not sure what else I could have done. I also multiple the SUM(C15:O15) * 24 but still 0:00:00 shown?! I am copying the row I want to add here as well


Total40:03:2844:38:4006:55:3721:05:5003:04:5501:42:1201:31:2914:51:0611:01:4422:53:4049:56:10103:31:4995:24:020:00:00

<tbody>
</tbody>

Thank you so much.

https://drive.google.com/file/d/1Tn1e73RuyRh4W4Y250VX5SXnr-HAeiHA/view?usp=sharing
 
Thank you so much. Going to do it now and will let you know the result. Thanks again
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Ricks suggestion is good if you can't/don't want to have a separate table but my reason for this post is if you are working with the separate table idea then once you have put in the formulas then copy/paste as values to save unnecessary calculations and just keep the simple sum formulas as formulas.
Sorry it was too late to re-edit my original post.
 
Last edited:
Upvote 0
Yes, that is amazing. Thank you very much. But how come it did work with sumproduct() ? also can I ask you why 0 is added please. Thanks a lot once again.

Does this formula work for you (using the original range you posted with your values remaining as Text)...

=SUMPRODUCT(C15:O15+0)

Format the cell you put this in using [h]:mm:ss
 
Upvote 0
It is ok thank you so much. I will try it as well to see if I can learn from it. Thank you so much.

Ricks suggestion is good if you can't/don't want to have a separate table but my reason for this post is if you are working with the separate table idea then once you have put in the formulas then copy/paste as values to save unnecessary calculations and just keep the simple sum formulas as formulas.
Sorry it was too late to re-edit my original post.
 
Upvote 0
also can I ask you why 0 is added please
The SUMPRODUCT function evaluates each cell of a range one cell at a time (you could also use SUM but then you would have to commit it with CTRL+SHIFT+ENTER) before performing the summation... adding 0 means 0 is added to and evaluated for each cell in the range. Time values in Excel are floating point numbers, but your time values are Text. Whenever you perform a mathematical operation on a Text value whose underlying value is numerical, Excel converts that Text number to a real number in order to be able to perform the mathematical operation. So, adding 0 to your Text time values converts them to real time values (the underlying floating point numbers) and then adds 0 to it (adding 0 to a number does not change it value)... that means each cell's Text time value has 0 added to it which makes each cell's value a real time value which SUMPRODUCT than sums up. The custom format then displays the floating point number to a familiar looking time value.
 
Last edited:
Upvote 0
It is ok thank you so much. I will try it as well to see if I can learn from it. Thank you so much.

Your welcome, I will let Rick explain how sumproduct works because of its use of arrays of True and False (although it is worth Googling it as there are some good explanations out there on the benefits of sumproduct). The +0 we both use just converts True and False to 1 and 0 so you can use them in calculations and changes numbers stored as text to real numbers.
Any arithmetical sign has the same effect which is why you will often see -- being used i.e. =SUMPRODUCT(--C15:O15) or =SUMPRODUCT(C15:O15*1).

Oops posted the same time as Rick, I won't delete the text here as I don't think anything in it detracts from what Rick has posted.
 
Last edited:
Upvote 0
Thank you all indeed. I will read all solution and google sumproduct as Mark suggested. I will try all solution to understand what is going on. Thank once again. Really appreciate.
 
Upvote 0
Thank you. I think I got it. I did exactly what you told me to do. Then I got similar table
The Total row, I created =SUM(C18:C29) in C30 then used auto fill to fill D30, E30, F30 etc until O30
Then in P30 I wrote =SUM(C30:O30).
With that I got in P30 = 17.3616

Now I can multiple P30 * 24 = 416.6783
Or change the format of P30 to
:mm:ss and get 416:40:42

Am I right?
Without all of you help, I wont be able to understand it. Thank you so much

<tbody>
</tbody>
As Fluff pointed out changing the format does not change the underlying value, it just changes its appearance (imagine looking at an image through a filter, the original image doesn't change but how you perceive it does). If you don't mind working with a separate table it is probably easiest to just reference the cells with a formula of the cell reference +0 and custom format the cells as [hh]:mm:ss i.e.


Excel 2016 (Windows) 64 bit
BCDEFGHIJKLMNO
2Monthovertime1overtime2overtime3overtime4overtime5overtime6overtime7overtime8overtime9overtime10overtime11overtime12overtime13
3JAN02:05:4201:35:5600:07:1707:30:3006:33:33
4FEB01:57:2402:40:4400:01:2600:06:0807:19:5409:16:22
5MAR02:45:5502:46:4702:07:5412:11:5612:20:01
6APR24:48:5319:56:5005:12:2304:00:2500:06:3601:07:0000:25:3506:36:5311:18:38
7MAY04:14:1515:15:3300:49:2403:15:1800:28:3400:02:3806:44:4908:26:00
8JUN01:13:5504:43:3700:17:2302:12:5200:13:0800:17:4200:28:4605:56:1306:42:3809:52:2623:27:2913:15:5808:41:48
9JUL00:19:3700:49:4700:11:0201:25:4500:07:4300:02:5806:07:2202:44:4810:18:0620:18:2111:16:3406:46:22
10AUG00:28:0401:10:3800:11:3700:49:1800:05:5400:16:1201:24:5300:55:5001:45:1403:11:0307:30:5506:25:28
11SEP00:19:0401:00:0500:02:1100:35:5100:03:5300:08:4700:39:3500:06:4700:19:3901:00:1907:42:4507:15:14
12OCT00:07:5000:51:0700:07:0400:43:5200:32:3500:09:3800:08:1700:32:0708:26:2805:39:39
13NOV00:06:4300:33:3900:04:3300:34:1200:06:4500:19:5000:26:3401:21:3607:44:1806:52:32
14DEC01:36:0600:17:2400:24:5000:00:2500:03:4300:02:1300:03:2400:05:1507:10:4905:48:25
15Total40:03:2844:38:4006:55:3721:05:5003:04:5501:42:1201:31:2914:51:0611:01:4422:53:4049:56:10103:31:4995:24:02
16
17Monthovertime1overtime2overtime3overtime4overtime5overtime6overtime7overtime8overtime9overtime10overtime11overtime12overtime13
18JAN02:05:4200:00:0000:00:0001:35:5600:07:1700:00:0000:00:0000:00:0000:00:0000:00:0000:00:0007:30:3006:33:33
19FEB01:57:2400:00:0000:00:0002:40:4400:01:2600:00:0000:06:0800:00:0000:00:0000:00:0000:00:0007:19:5409:16:22
20MAR02:45:5500:00:0000:00:0002:46:4702:07:5400:00:0000:00:0000:00:0000:00:0000:00:0000:00:0012:11:5612:20:01
21APR24:48:5319:56:5005:12:2304:00:2500:06:3601:07:0000:25:3500:00:0000:00:0000:00:0000:00:0006:36:5311:18:38
22MAY04:14:1515:15:3300:49:2403:15:1800:28:3400:00:0000:02:3800:00:0000:00:0000:00:0000:00:0006:44:4908:26:00
23JUN01:13:5504:43:3700:17:2302:12:5200:13:0800:17:4200:28:4605:56:1306:42:3809:52:2623:27:2913:15:5808:41:48
24JUL00:19:3700:49:4700:11:0201:25:4500:00:0000:07:4300:02:5806:07:2202:44:4810:18:0620:18:2111:16:3406:46:22
25AUG00:28:0401:10:3800:11:3700:49:1800:00:0000:05:5400:16:1201:24:5300:55:5001:45:1403:11:0307:30:5506:25:28
26SEP00:19:0401:00:0500:02:1100:35:5100:00:0000:03:5300:08:4700:39:3500:06:4700:19:3901:00:1907:42:4507:15:14
27OCT00:07:5000:51:0700:07:0400:43:5200:00:0000:00:0000:00:0000:32:3500:09:3800:08:1700:32:0708:26:2805:39:39
28NOV00:06:4300:33:3900:04:3300:34:1200:00:0000:00:0000:00:0000:06:4500:19:5000:26:3401:21:3607:44:1806:52:32
29DEC01:36:0600:17:2400:00:0000:24:5000:00:0000:00:0000:00:2500:03:4300:02:1300:03:2400:05:1507:10:4905:48:25
30Total40:03:2844:38:4006:55:3721:05:5003:04:5501:42:1201:31:2914:51:0611:01:4422:53:4049:56:10103:31:4995:24:02

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
OT

Worksheet Formulas
CellFormula
B17=B2
C17=C2
B18=B3
C18=C3+0
C30=SUM([COLOR=rgb(255]C18:C29[/COLOR])

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,244
Members
448,879
Latest member
VanGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top