Convert Decimal time to hh:ss in cell

crashcb18

New Member
Joined
Aug 20, 2011
Messages
12
All,
I'm trying to convert the decimal value of time to the military time hh:ss inside a cell without the Format window. The VBA property [numberformat] doesn't seem to work, and I guess Excel 2010 took out the "Format" function? i.e.:

H14 = 13:30 (as text format, from some other cell code)
H16 = TIMEVALUE(H14) which equals 0.5625

Now, I'd like to turn H16 into an actual number. Basically, I'm trying to turn a cell of "13:30 Z" and just extract the numbers, which I did fine, but then turn the text 13:30 into actual time number 13:30.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
H16 is a number; just format it as hh:mm

If A1 constains 13:30 Z, then =--LEFT(A1,5) returns 0.5624 which can be formatted as hh:mm to see 13:30
 
Upvote 0
Thanks! My question though, is what syntax do I type into the cell to reflect hh:mm? I get the "hh:mm" part, but what function do I type in front of it? "FORMAT(CELL,"hh:ss")?
 
Upvote 0
You mean in VBA?
Code:
Range("A1").NumberFormat = "hh:mm"

... or from the UI?

Select the cell, do Ctrl+1, select the Number tab, select Custom in the Category box, and put hh:mm in the Type box.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,833
Members
452,947
Latest member
Gerry_F

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