Time Format Needed

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
975
What format would I use if I wanted a cell to display as hours:minutes? For example, if someone typed in 1.65 it would automatically translate that to 2:05?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Just to make sure I understand, would it always be that the number before the decimal would be hours and the number after the decimal would be minutes? So that 1.65 is 1 hour + 65 minutes = 2 hours 5 minutes, and NOT 1.65 hours which is actually 1 hour 39 minutes?
 
Upvote 0
=text(yourcell,"h:mm")

Actually, that doesn't give the result for which he is looking.

It would be simple enough to create a formula that would link to the input cell and make it work, but, Brian, you definitely need this as a format for the input cell, correct? An interesting challenge this is!
 
Upvote 0
I am wondering how this number was obtained?

if you want 1.65 to show as 2:05.

based on the other comments the 1 represents an hour - if that is the case then how did the digits to the right of the decimal ever get above 60? I am suspicious of that.

Anyways, just to parse the text you could use(value is in A1):


=IF(RIGHT(A1,LEN(A1)-FIND(".",A1))>60,LEFT(A1,FIND(".",A1)-1)+1,LEFT(A1,FIND(".",A1)-1))&":"&IF(IF(RIGHT(A1,LEN(A1)-FIND(".",A1))>60,RIGHT(A1,LEN(A1)-FIND(".",A1))-60,RIGHT(A1,LEN(A1)-FIND(".",A1)))<10,"0"&IF(RIGHT(A1,LEN(A1)-FIND(".",A1))>60,RIGHT(A1,LEN(A1)-FIND(".",A1))-60,RIGHT(A1,LEN(A1)-FIND(".",A1))),IF(RIGHT(A1,LEN(A1)-FIND(".",A1))>60,RIGHT(A1,LEN(A1)-FIND(".",A1))-60,RIGHT(A1,LEN(A1)-FIND(".",A1))))
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,239
Members
452,898
Latest member
Capolavoro009

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