fractional pennies

G

gary

28,000 cells are SUPPOSED to be rounded to 2 decimal
places. However, their total is:
28,0004,231,983.34000001000.

How do I find the cells containing these fractional
pennies?
 
G

Guest

Hi

Use a helper column alongside your data with this in:
=F1*100<>INT(F1*100)
Fill this down the column and wherever it returns TRUE is where you need to
check.
 
G

gary

The 4,231,983.34000001000 is =SUM(f1:f29910).

However, your formula does NOT return "TRUE" for ANY of
the cells in the above range.

More help is needed.

Gary


is >-----Original Message-----
 
J

John Woodgate

I read in microsoft.public.excel.misc that gary <[email protected]
icrosoft.com> wrote (in said:
The 4,231,983.34000001000 is =SUM(f1:f29910).

However, your formula does NOT return "TRUE" for ANY of the cells in the
above range.

More help is needed.

Computers use binary numbers. People use decimal numbers. There can be
very small oddities involved in the conversions. Why not format your
cell to show just two places of decimals and forget about the millionth
of a penny in 4 billion dollars?
 
G

gary

John,

Back to my original question: "How do I find the cells
with the fractional pennies?"

Gary
 
J

John Woodgate

I read in microsoft.public.excel.misc that gary <[email protected]
icrosoft.com> wrote (in said:
Back to my original question: "How do I find the cells with the
fractional pennies?"

My guess is that there aren't any. The micropenny emerges in the last
arithmetical operation. Your computer converts a lot of decimal values
to binary, adds them up and converts the result back to decimal. In the
conversion processes, it's not impossible for a minute deviation to
occur far down the decimal places. It depend on exactly how Excel does
the conversions. It isn't a simple process, because Excel can handle
numbers from 10^(-307) to 10^307, whereas normal 32-bit binary can only
go up to 4294967295.
 
G

gary

=SUM(f1:f29910) results in 4,231,983.34000001000

To find the cells containing fractional pennies, I've
tried Andy's suggestion -- =F1*100<>INT(F1*100) -- but it
does NOT return "True" for any of the cells.

Help!

Gary
 
J

Jerry W. Lewis

Almost all of them are probably inexact, but not so much that you would
notice or could detect. It is the accumulation of all the negligible
approximations that is no longer entirely negligible.

As John Woodgate pointed out, computers do binary arithmetic, not
decimal arithmetic. The decimal fractions .00, .25, .50, and .75 can be
exactly represented in binary. No other 2-place decimal fractions can
be exactly represented in binary, and so must be approximated. For
instance, the binary approximation to 0.20 is
3602879701896397/18014398509481984
which in decimal is
0.200000000000000011102230246251565404236316680908203125
You cannot directly detect this approximation, because it differs from
0.2 in the 17 figure, whereas Excel will display no more than 15
meaningful figures.

Indirectly, you can sometimes detect the binary approximations via
subtraction. For instance, the binary approximation to 0.3 is
5404319552844595/18014398509481984
which in decimal is
0.299999999999999988897769753748434595763683319091796875
Thus the formula =(0.2+0.2+0.2-0.3-0.3) will return 1.11022302462516E-16
instead of zero. Here (as in your case) Excel is giving the exactly
correct answer to a math problem that only approximates the problem that
you intended. This is an issue with almost all computers and software,
since almost all computers and software do binary math.

In your case, you can do one of two things:
- Avoid decimal fractions entirely. Multiply all your numbers by 100,
to get integers (which can be exactly represented in binary) then you
can add 28,000 of them with no fear of accumulating approximation residues.
- Round the final result to 2 decimal places, since you know that
anything beyond that is residue from the binary approximations.

Jerry
 
Top