Numbers - Format Issues for Converting Time to Decimal

Looking to convert a time value into a decimal. To explain further, I'm logging all time spent while working. In Column A and B, I have block in and out. Column C takes the difference of those values to produce the 01:20 (1hr:20min). I'm wanting to convert that into 1.3 (rounded to nearest tenth). Each 0.1 = 6min. Every time I try to change the formatting of the cell to number or text, my selection reverts back to Automatic and Duration. Has anyone figured out a way around this? Does Numbers not recognize time in 24hr like it does in Excel? Is this a bug?

MacBook Pro 13″, macOS 13.3

Posted on Mar 1, 2024 1:12 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 1, 2024 4:27 PM

Your formula creates a duration. A duration is not a decimal number or text so you cannot force either of those formats upon it. There are functions to convert a duration into a decimal number of days, hours, minutes, seconds, etc. You want DUR2HOURS to do the conversion to hours. Then you want ROUND to round it to the nearest 1 decimal place.


=ROUND(DUR2HOURS(your_duration_formula),1)

Similar questions

7 replies
Question marked as Top-ranking reply

Mar 1, 2024 4:27 PM in response to Mach03

Your formula creates a duration. A duration is not a decimal number or text so you cannot force either of those formats upon it. There are functions to convert a duration into a decimal number of days, hours, minutes, seconds, etc. You want DUR2HOURS to do the conversion to hours. Then you want ROUND to round it to the nearest 1 decimal place.


=ROUND(DUR2HOURS(your_duration_formula),1)

Mar 1, 2024 9:48 PM in response to Mach03

Mach03 wrote:

an error was returned saying that it required two arguments but only showed one. I ended up only needing to use the DUR2HOURS for the results I needed.


You probably missed one of the ().


Keep in mind that without the ROUND function, using "just" DUR2DAYS, you can format the cells to make it appear that you are getting the rounded result you want. But the actual value in the cell may still have extra decimal places that you have hidden. That may not matter if you just want to display the results. But it will cause problems if you are doing further calculations (such has multiplying by an hourly rate).


If you are doing ongoing calculations you need to use one of the ROUND functions, ROUND, MROUND, FLOOR, or CEILING.


Here's a simple example showing how they produce different results:


Functions used to round values – Apple Support (UK)

ROUND – Apple Support (UK)

MROUND – Apple Support (UK)

CEILING – Apple Support (UK)

FLOOR – Apple Support (UK)



BTW, you are correct in noticing that Numbers handles date and time differently from Excel. Numbers stores date-time strings. Excel uses a serial date system. Excel doesn't have the DUR2 functions. Each approach has its advantages and disadvantages.


SG






This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Numbers - Format Issues for Converting Time to Decimal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.