excel round function not

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Excel round function not adding to zero

Excel round function not adding to zero

resolvedResolved · Urgent Priority · Version 2010

Titus has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course

Excel round function not adding to zero

I have a worksheet with about 8000 rows of data which need to sum to zero (this is a journal that needs to be zero for posting into our ledger). The ledger requires that all numbers be formatted to two decimal places.

The issue arises in that I have rounded all the numbers to two decimal places (using the round function), however when I sum the column the value does not equal zero. It comes to something like 0.0000045698.

I have checked that all the entries are rounded to two decimal places in various ways and they definitely all are.

I have also noticed that there are a couple of large negative numbers and if I remove these, the sum cell shows two decimal places as expected.

By way of additional info, if I round to more than 2 decimal places, I get exactly the same number in the sum cell, whereas if I round to 1 decimal place I get a different number (which is not zero). If I round to zero demical places, I get an integer as I would expect.

I have looked at some forums and guess that this must be to do with the way Excel stores numbers, particularly negatives, but I can't see a solution.

Any thoughts?

Thanks

RE: Excel round function not adding to zero

Hi Titus

Thanks for getting in touch. The ROUND function will generate results like this over large arrays, as the micro errors catch up with you. With all the rounding up and down eventually there will be odds and ends left over. As you've discovered Excel does store things imperfectly at these levels (it's to do with binary numbers, more info here http://support.microsoft.com/kb/214118 ).

There's an excellent article here describing the Microsoft article in clearer language using ROUND + "Set precision as displayed":

http://www.k2e.com/tech-update/tips/139-handling-rounding-issues-in-excel

Alternatively, have you considered using the TRUNC function? This discards the remaining decimals.

No complete answers there Titus, but some more food for thought I hope.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: Excel round function not adding to zero

Hi Gary, many thanks for the swift response...

The "set precision as displayed" option works beautifully.

Cheers!

 

Training courses

 

Training information:

See also:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Validating text entries

1. Select the range of cells.
2. From the Data menu, select Validation.
3. Select the Settings tab.
4. From the Allow dropdown list, select Custom.
5. In the Formula box, enter the following formula:

=IsText (A1)

where A1 is the first cell in the range.
6. Click OK.

View all Excel hints and tips


Server loaded in 0.07 secs.