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.
Excel stores datetime values as:
In your example, you are converting a decimal to a textual representation of the hour and minute portions of the datetime value.
Working through your first formula, 0.22 divided by 14 (why are you doing this?) equals 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 your 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’).