Time conversion - Again!!

ByteMe

Board Regular
Joined
Mar 9, 2005
Messages
85
Hi there,

Is it possible to convert numbers such as '7.5' (7 hours & 30 mins) to a correct time of 07:30 & then convert it to a text format of 00730.

Basically cell A1 has the value of 7.5 & i need cell B1 to show 00730

I need the format of the cell to end up as text and NOT formatted as hhhmm.

Secondly, if the value is 30.98 then I need the formula to account for it being over 24.

E.g. 30.98 would end up as 03058

Any more ideas??

Kind regards
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try

=RIGHT(0&TEXT(A1/24,"[hh]mm"),5)

note:edited to account for hours over 100, although I'm not sure what you'd require if hours go over 1000.....
 
Upvote 0
...actually a better way...

=TEXT(A1/24,"[hhh]mm")

although this will always round the minutes down, so 7.33 will give you 00719 when to the nearest minute it should be 00720. If you're worried about that use

=TEXT(ROUND(A1*6,1)/144,"[hhh]mm")
 
Upvote 0
Date conversion

Barry - that was perfect, exactly what i needed. Starryeyed - it does work but if the hours are 108 then it produces the answer of 0010800 and i need the answer to have a maximum of 5 digits.

Thanks to you both.
 
Upvote 0
Just a quick thought....

Why do you multiply by 6 & then divide by 144??

e.g. =TEXT(ROUND(A1*6,1)/144,"[hhh]mm")

Regards
 
Upvote 0
To round A1/24 to the nearest minute (1/1440th of a day)

=ROUND(A1*1440/24,0)/1440

this is the same as

=ROUND(A1*60,0)/1440

which you can simplify to

=ROUND(A1*6,1)/144

If you have Analysis ToolPak enabled you could use MROUND and

=TEXT(MROUND(A1/24,1/1440),"[hhh]mm")
 
Upvote 0

Forum statistics

Threads
1,222,660
Messages
6,167,427
Members
452,112
Latest member
BPNuyttens

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