# Strange Formula Problem

#### jaysh

##### New Member
It's me again. Just want to thank you guys again for being very helpful.

Have a weird problem.

If i'm in excel and do =sum(at:at) it comes out to a dollar amount of 42.99 (expected)

However, when i'm in VBA and doing:

Set freight = ws1.Range("AT:AT")

ws3.Range("B2") = Application.Sum(freight)

It comes pretty close to the number but instead it is something like 42.989932

The weird part is that there are no extra decimel places anywhere in column AT to give it these extra places. Any ideas?

### Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

#### delaneyjm

##### Well-known Member
It's a floating point issue likely. All computer programs suffer from it. It stems from converting numbers from base 10 to binary. Sometimes it doesn't go as cleanly as humans interpret.

#### jaysh

##### New Member
So from what it sounds like, there is no fix for that? I mean the numbers are so close that I can't see it being a problem. However, I want to make sure that if I go into alot higher numbers, it wont be throwing it off by dollars.

Any help?

Thanks!

#### delaneyjm

##### Well-known Member
Can you post some sample data and the full code that you used?

#### delaneyjm

##### Well-known Member
Checked over your file. VBA is returning a different value (albeit the same when formatted) compared to doing AutoSum.

You could use some form of rounding method after doing the Application.Sum or instead of this code:

Code:
``````Set freight = ws1.Range("AT:AT")
ws3.Range("B2") = Application.Sum(freight)``````

you could run
Code:
``````Set freight = ws1.Range("AT:AT")
ws3.Range("B2").Formula = "=SUM(AT:AT)"``````

#### jaysh

##### New Member
Thank you much!!

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,164,008
Messages
5,834,866
Members
430,324
Latest member
bosphoruskid

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back