Hrs & Mins format

Spraggs

Well-known Member
Joined
Jan 19, 2007
Messages
704
Morning All,
In cell B3 I have minutes and A3 seconds.
This instance 108 (B3) and 56 (A3).
In cell C3 I want a formula and format that will result in Hr:Min:Sec (1:48:56)

Many Thanks Jase
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
or try
Code:
=FLOOR((A3*60)+B3,3600)/3600 & ":" & FLOOR(((A3*60)+B3) - FLOOR((A3*60)+B3,3600),60)/60 & ":" & MOD((A3*60)+B3,60)

format as General

This takes the minutes and multiplys by 60 and adds the seconds.
You then take the floor of that value / 3600 (3600 seconds in an hour) which gives you the hours as an integer. You then append a : and do the FLOOR of the remainder / 60 which gives you the minutes, append the : and then take the MOD of minutes which gives you the seconds.

This will work where the hours are > 24 and where the seconds are > than 60.

Which displaying a datetime as HH:mm:SS will not.
 
Upvote 0
You need a Custom format of [h]:mm:ss for my formula to correctly display durations greater than 24 hours

Excel Workbook
ABC
363150825:09:03
Sheet3
 
Upvote 0
good call VoG!

I have also noticed I got my minutes and Seconds columns mixed up!

Use VoGs method is you need to do further manipulation on the dates. use my method if you need to ensure that the data is output in that format (mine is a string representation of the time)
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,136
Members
452,890
Latest member
Nikhil Ramesh

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