help needed in Calculating hours..

pinchoo

New Member
Joined
Jan 1, 2018
Messages
1
Hi I have values in multiple cells like

I want to calculate the number of hours based on below values

Input -
2d, 1h, 29m, 28s
[TABLE="width: 108"]
<tbody>[TR]
[TD]6h, 43m, 2s [/TD]
[/TR]
[TR]
[TD]6h, 21m, 35s [/TD]
[/TR]
[TR]
[TD]2h, 26m, 32s [/TD]
[/TR]
[TR]
[TD]5h, 36m, 10s [/TD]
[/TR]
[TR]
[TD]3h, 3m, 25s [/TD]
[/TR]
[TR]
[TD]28s

Output
25.5
6.8
6.4
2.5
5.6
3.1
0

Thanks![/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Assuming the values are in A1 to D1

=24*(LEFT(A1,LEN(A1)-1))+(LEFT(B1,LEN(B1)-1))+(LEFT(C1,LEN(C1)-1)/60)+(LEFT(D1,LEN(D1)-1))/3600
 
Upvote 0
I could only get this to work for the first number if i changed -1 to -2
 
Upvote 0
Hi I have values in multiple cells like

I want to calculate the number of hours based on below values

Input -
2d, 1h, 29m, 28s
[TABLE="width: 108"]
<tbody>[TR]
[TD]6h, 43m, 2s[/TD]
[/TR]
[TR]
[TD]6h, 21m, 35s[/TD]
[/TR]
[TR]
[TD]2h, 26m, 32s[/TD]
[/TR]
[TR]
[TD]5h, 36m, 10s[/TD]
[/TR]
[TR]
[TD]3h, 3m, 25s[/TD]
[/TR]
[TR]
[TD]28s

Output
25.5
6.8
6.4
2.5
5.6
3.1
0

Thanks![/TD]
[/TR]
</tbody>[/TABLE]


25.5 is wrong, two days is 48 hours
 
Upvote 0
My original reply did not deal with the blank cell case, this will:
=24*IFERROR((LEFT(A1,LEN(A1)-1)),0)+IFERROR((LEFT(B1,LEN(B1)-1)),0)+IFERROR((LEFT(C1,LEN(C1)-1)/60),0)+IFERROR((LEFT(D1,LEN(D1)-1)),0)/3600

I could only get this to work for the first number if i changed -1 to -2
I didn't have the comma in cell so -1 works for me. I depends on exactly what the OP cells contains
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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