ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Converting time to decimal then rounding (https://www.excelbanter.com/excel-discussion-misc-queries/251932-converting-time-decimal-then-rounding.html)

JB Bates[_2_]

Converting time to decimal then rounding
 
Hi

I have a formula

=MOD(T11-R11,1)*24

Where T11 is 22:43 and R11 is 22:34

The difference of these time values is 9 minutes or .15. Currently I am
getting the result of .1 because it is not rounding up. The result I need is
..2 -- so that Excel will round .01 to .04 down and .05 to .09 up.

How should I adjust my formula? Thanks!!

מיכאל (מיקי) אבידן

Converting time to decimal then rounding
 
Maybe:
ROUNDUP((A1-A2)*24,1)
Micky


"JB Bates" wrote:

Hi

I have a formula

=MOD(T11-R11,1)*24

Where T11 is 22:43 and R11 is 22:34

The difference of these time values is 9 minutes or .15. Currently I am
getting the result of .1 because it is not rounding up. The result I need is
.2 -- so that Excel will round .01 to .04 down and .05 to .09 up.

How should I adjust my formula? Thanks!!


David Biddulph[_2_]

Converting time to decimal then rounding
 
Obviously a question of small rounding errors.
=MOD(T11*24*60-R11*24*60,24*60)/60 seems to work.
If it doesn't always work, you might need to round each component to whole
minutes by
=MOD(ROUND(T11*24*60,0)-ROUND(R11*24*60,0),24*60)/60
--
David Biddulph

JB Bates wrote:
Hi

I have a formula

=MOD(T11-R11,1)*24

Where T11 is 22:43 and R11 is 22:34

The difference of these time values is 9 minutes or .15. Currently I
am getting the result of .1 because it is not rounding up. The
result I need is .2 -- so that Excel will round .01 to .04 down and
.05 to .09 up.

How should I adjust my formula? Thanks!!




Daryl S

Converting time to decimal then rounding
 
JB -

Skip the MOD for time values:

=ROUND((T11-R11)*24,1)

--
Daryl S


"JB Bates" wrote:

Hi

I have a formula

=MOD(T11-R11,1)*24

Where T11 is 22:43 and R11 is 22:34

The difference of these time values is 9 minutes or .15. Currently I am
getting the result of .1 because it is not rounding up. The result I need is
.2 -- so that Excel will round .01 to .04 down and .05 to .09 up.

How should I adjust my formula? Thanks!!



All times are GMT +1. The time now is 07:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com