I have an excel cell "E2" that has a number 31.9 and I want to convert it to 31 hours 54 minutes. What line(s) of code could I use? Thanks in advance!
[/color]
But you may not have understood the earlier method:
Right-click on the cell and select "Format Cells..."
Then, select "Custom" from the "Category:" list and enter the format in the box where it says "Type:" and click OK.
I did understand what to do in the "format cells" but in office 2K I get 7:52am. Anyway, your line of code worked great and I thank you again!!
The first solution by Zathras was a very near miss.
Replace [h] by [hh] to get the hours to be reported in excess of 24. With the single h you get only the hours left over after the time is converted into days. (ie Excel converts 31 hours to 1 day 7 hours and gives you the 7).
You should get the 54 minutes. 52 minutes suggests you do not have exactly 0.9 of an hour but something that rounds to 0.9 when shown to one decimal place.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.