Rounding Problem

M

Mike H.

I have a variable, dimensioned as Single, that I have in a loop doing this:
JETotal=Debit-Credit
Debit and Credit are both also Dim'd as Single.
The Code to accumulate cost is:
JETotal = Round(JETotal + Debit - Credit, 2)
But when done, the JETotal variable does NOT equal Zero. But if I go in the
spreadsheet and sum the 2 columns and net them, I get Zero. How do I solve
this problem?
 
J

Jerry W. Lewis

What happens if everything is Dim'd Double (the worksheet defaults to double
precision). With numbers around 1E6, Single may not give 2-decimal place
accuracy.

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top