Forum Discussion
sliao8788
Mar 06, 2021Copper Contributor
convert numbers to time
Hi I am trying to convert a number format in one cell to time format in another cell. Here is my example In cell A1 I have a number 1.90 and I need it to be converted into 1:90 in cell B1. what for...
sliao8788
Mar 06, 2021Copper Contributor
Thanks, This kind of solves the problem. but this was what I was trying to do,
In cell A1 I have a number 1.90 and I need it to be converted into 1:90 in cell B1. what formula do I use.
In cell A1 I have a number 1.90 and I need it to be converted into 1:90 in cell B1. what formula do I use.
JMB17
Mar 06, 2021Bronze Contributor
If you just want it to display "1:90", then you could try:
=SUBSTITUTE(TEXT(A1,"0.00"),".",":")
But, it will be a text value, so you won't be able to perform any arithmetic operations with it very easily.
I believe you could use:
=TIMEVALUE(SUBSTITUTE(TEXT(A1,"0.00"),".",":"))
and format it as [h]:mm and it would be an actual numeric time value, but it will display as "2:30" and not "1:90". If you want it to display as hours:minutes, then I'm not sure how you stop excel from incrementing the hours when you go past 60.
=SUBSTITUTE(TEXT(A1,"0.00"),".",":")
But, it will be a text value, so you won't be able to perform any arithmetic operations with it very easily.
I believe you could use:
=TIMEVALUE(SUBSTITUTE(TEXT(A1,"0.00"),".",":"))
and format it as [h]:mm and it would be an actual numeric time value, but it will display as "2:30" and not "1:90". If you want it to display as hours:minutes, then I'm not sure how you stop excel from incrementing the hours when you go past 60.
- sliao8788Mar 07, 2021Copper Contributor
JMB17 Thanks for the help. I need it in time value as I will be adding it up.
- JMB17Mar 07, 2021Bronze ContributorThen, I believe the second option will work.
=TIMEVALUE(SUBSTITUTE(TEXT(A1,"0.00"),".",":"))
Which is the same as what Nikolino is suggesting, but formatting the number to 2 decimals before replacing the "." with ":" as it appears excel interprets "1:9" as 1 hr 9 minutes. So, it seems you have to force the two decimals to get it to see it as 90 minutes.
Numerically, 2:30 is the same as 1:90, so it should make no difference for your calculations.- sliao8788Mar 07, 2021Copper Contributor
JMB17, Thanks for the response. This seems to be working. Appreciate your help. Now I have come up with another problem. Eg: Cell A1, if I have a number that is 26.00 with the formula in cell B1, it returns with 2:00 and not 26:00. Is there a way to make excel recognise this number as I know the time in excel is 24 hrs period. Also thanks to NikolinoDE and Riny_van_Eekelen for you help.