Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wrong answer in excel formula 2

Status
Not open for further replies.

dbpcar

Programmer
Mar 1, 2001
39
US
I am doing credit/debit entries in a blank workbook and instead of a zero balance I am getting the following:
-8.88178E-15
as the result instead of zero. I dumped that workbook and started a new one, and I still have the same problem. I am a little confused here.
This is an issue because the entries are transferred to the accounting program and then I am out of balance.
Is this an excel problem that can be fixed or is the opening worksheet messed up?
Thanks
 
dbpcar,

If you modify your formula to include the ROUND function, it should eliminate your problem.

"Internally", Excel is not evaluating your result to EXACTLY "0" - it has a long number of decimals. The ROUND function will correct for this.

Hope this helps.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Thanks for your response, Dale. The problem is not what I can see, I can correct for that. The problem is in transferring to my accounting program, that amount is still in the cell as an artifact, even when I see zero.
dbpcar
 
try using a formula like

=INT((A1*100))/100

the Int function will give you the interger part of the number. By multiply and dividing by 100 (or however many decimal places you need) then you can start with a number like 100.01234 and end up with 100.01 - This should get rid of very small numbers like the one you are seeing. Sandy
 
Sorry just noticed a typo formula should be:

=INT((A1*100))/100 Sandy
 
This is not an Excel problem, nor is it an 'error' in the formula. It is inherent in the way computers handle 'floating point' calculations. If you must have exact results, you can either use rounding as B827 suggests, or you can check 'Precision as displayed' under Tools->Options->Calculation, which will truncate all values in the file to the exact value displayed.
 
Another possibility...

I just tested the -8.88178E-15 number by saving it as a "CSV" (comma delimited) file. When loading it back into Excel, it shows "0".

If the other suggestions don't work, possibly this method will work in transferring your data to your accounting program.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Problem solved, I used the INT solution, it works best in my macros. Thanks for all the input.
dbpcar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top