Another rounding issue

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Folks!

Here's another rounding issue I just discovered:

A2 = 9:00 PM (not calculated, manually entered)
B2 = 10:00 PM (not calculated, manually entered)
C2 formula: =B2-A2+(B2<A2) Formatted as h:mm returns as expected 1:00
D2 formula: =IF(C2<1/24,1/24-C2,0)

Without preformatting cell D2 it defaults to GENERAL and unexpectedly
returns 3.46945E-17 which is the value_if_true argument of the IF function.

When formatted as h:mm it returns 0:00.

If cell D2 is formatted as h:mm and is tested to be = 0 FAILURE!

Here's how it breaks down:

=IF(0.0416666666666666<0.0416666666666667,1/24-C2,0)

=(B2-A2+(B2<A2))*24 returns 1 as expected. However, if formatted as number
to 15 decimal places returns 0.999999999999999. So, if that formula was
tested to return = 1 it would also fail.

But........ change:

A2 = 11:00 AM
B2 = 12:00 PM

(not drag filled either!) D2 returns 0 as expected and when tested for = 0
passes.

Hmmmm!

Just be aware!

Biff




.



Relevant Pages

  • Re: Another rounding issue
    ... Biff wrote: ... Without preformatting cell D2 it defaults to GENERAL and unexpectedly ... easily fall into with relational tests regarding fractions. ... The SumProduct function should implicitly coerce the truth values to their Excel numeric equivalents. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: MOD function computation error
    ... It's rounding issue of the MOD function ... Biff ... > Excel 2003. ... > Didn't know where to write to Microsoft bug-report or something. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Problem comparing double values
    ... > better than the epsilon test even if it will probably be ever so ... > of its own due to its use of Banker's Rounding. ... VB.Net: "Fool me once..." ... Prev by Date: ...
    (microsoft.public.vb.general.discussion)
  • Re: Stop numbers from Rounding
    ... > How do you stop numbers from rounding to whole numbers in Access 2003. ... > NealJH ... I do not reply to personal e-mail ... Prev by Date: ...
    (microsoft.public.access.gettingstarted)
  • I am trying to round up to the nearest 25 cents
    ... I am trying to round a money value to the nearsest 25 cents and it keeps ... rounding to the nearest dollar HELP ... Prev by Date: ...
    (microsoft.public.excel.newusers)