The integer part of a division


#1

Hi,

i can’t get the integer part of the result of a division.

The aim is to transform for exemple 5400 (a number representing seconds) in that string: “1h 30mn”.
To get the hours, i divide 5400 by 3600. The result is 1.5.
Using the ROUND function does not work: i get “2” when i want “1”.
Same thing with the number formating options.

It may be obvious but i can’t find a way!


#2

To round down to the nearest integer (also known as a Floor function), you can subtract 0.5 from the number and use the Round function. For example, ROUND(NumMinutes - 0.5). This will give you the result 1 for the value 1.5.


#3

Hi, thanks for the reply.

It work if i know beforehand the value of the division, but it was an exemple.
My question was more abstract: I have that formula seconds / 3600, how to get the nearest integer from the result?

Finally, i have resolved my problem. Here it is for anyone who could need it:
IF((MOD(seconds, 3600) / 3600) >= 0.5, ROUND(seconds / 3600) - 1,ROUND(seconds / 3600))

Is there a simpler solution?