xercs
asked on
Expressing Excel formula in Java (decimal to time interpretation)
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.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").
=INT(R5/14*24)
To get the second part or minutes:
=R5/14*24*60-INT(R5/14*24)
Kevin