Claus Busch said:
round down to the next full 5 minutes:
=ROUNDDOWN((B1-A1)*288,0)/288
round down to the next full quarter of an hour:
=ROUNDDOWN((B1-A1)*96,0)/96
round down to the next full half hour:
=ROUNDDOWN((B1-A1)*48,0)/48
3Suk said:
please explain a bit of your formula, e.g. what does
the "48" mean?
Claus simplified the arithmetic.
Excel time is stored as a decimal number of days. There are 24*60 = 1440
minutes in a day.
So to round down elapsed time to a multiple of n minutes, the general
formula is:
=ROUNDDOWN((B1-A1)*1440/n,0)*n/1440
That is, first we convert Excel time (B1-A1) to minutes by multiplying by
1440; then we compute the number of n-minute increments by dividing by n and
rounding down; then we compute the number of minutes by multiplying by n;
and finally, we compute the decimal number of days (Excel time) by dividing
by 1440.
For 30-minute increments, that becomes:
=ROUNDDOWN((B1-A1)*1440/30,0)*30/1440
Note that 1440/30 is 48; and 30/1440 is 1/48.
So that becomes:
=ROUNDDOWN((B1-A1)*48,0)*1/48
which is simply:
=ROUNDDOWN((B1-A1)*48,0)/48