Solved

Expressing Excel formula in Java (decimal to time interpretation)

Posted on 2008-09-29
3
249 Views
Last Modified: 2012-05-05
Hi, I am converting an excel sheet formula to java but I can't understand how excel manages to take the following: 0.22, Applies a formula: =TEXT(R5/14, "h:mm") and somehow arrives at: 0.22

Again if I provide: 2.8 it arrives at 4.48 Can someone please explain to me how it does this. I have read a little regarding decimal and I understand the conversion but this hasn't yet helped to explain the above.
0
Comment
Question by:xercs
  • 2
3 Comments
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 22602313
To get the first part or hours:

=INT(R5/14*24)

To get the second part or minutes:

=R5/14*24*60-INT(R5/14*24)*60

Kevin
0
 

Accepted Solution

by:
xercs earned 0 total points
ID: 22602457
Thanks, but I figured it out.
0.22 divided by 14 (I'm unsure why its 14) but this is 0.015714286. If you then apply this fraction against a 24-hour day (multiply by 1440 minutes), it equals 22 minutes and some change (i.e. "0:22").

Working through the second formula, 2.8 divided by 14 equals 0.2. Multiplied by 1440, it equals 288 minutes, which is 4 hours and 48 minutes (i.e. "4:48").
0
 

Author Comment

by:xercs
ID: 22602462
Thanks, but I figured it out.
0.22 divided by 14 (I'm unsure why its 14) but this is 0.015714286. If you then apply this fraction against a 24-hour day (multiply by 1440 minutes), it equals 22 minutes and some change (i.e. "0:22").

Working through the second formula, 2.8 divided by 14 equals 0.2. Multiplied by 1440, it equals 288 minutes, which is 4 hours and 48 minutes (i.e. "4:48").
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now