custom format hours and minutes

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,056
Office Version
  1. 365
Platform
  1. Windows
can anyone provide me with the correct syntax for a custom format of cells that will display the contents as (for example, 30.40) "30Hrs 40Mins"? I currently have
Code:
##"Hrs" .##"Mins"
but this only gives me 30Hrs.4Mins. i need the trailing zero.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
format cells / custom
Code:
[h]" hour(s) "mm" minute(S)"
type in 1:30
should show 1 hour 30 minute(s)
 
Upvote 0
thanks for your response. i am formatting a cell that holds a calculated value so the method you mention will not work. I need something that will work on a decimal number.
 
Last edited:
Upvote 0
I'm not sure its possible with a custom number format. I can't come up with one, anyway. Seems like you require a conversion first -- decimal value to a time value or a text value.
 
Upvote 0
Since you're not going to be able to get rid of the decimal point in a number format, I worked it into how it is displayed. How does this work for you?

0"Hrs". 00"Min."
 
Upvote 0
that will do nicely HP. I had not thought of using the zeroes like that. instead I was trying every other way using the # as a placeholder.

Cheers
 
Upvote 0

Forum statistics

Threads
1,224,570
Messages
6,179,611
Members
452,931
Latest member
The Monk

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