# 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.
###### Who is Participating?

Author Commented:
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

ConsultantCommented:
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

Author Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.