Trying to stop Excel 2003 from rounding

breechd

New Member
Joined
Jul 16, 2010
Messages
14
I have an excel spreadsheet that is automated using Visual Basic. My master spreadsheet receives data from 31 different sheets. I realized that when it is compiling it is rounding up. I have tried everything I know to get it to stop rounding because the data with rounding is incorrect. I need the cell to have 1.50 or 0.50 in it, not 2.00 or 0.00. Has anyone else encountered this problem with an automated sheet? Is there a solution? Please let me know. Thanks, Deb!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Examine the VBA closely to make sure the author used floating point numbers and not integers.
 
Upvote 0
Ruddles,

Thank you for the quick response. I am the author and I used LngScore as Boolean. Hope this explanation helps.
 
Upvote 0
I've no idea what you mean by that.

What I was referring to was: if you're using VBA to transfer data from one worksheet to another, how are you doing that? Are you storing values in an integer somewhere along the way and losing decimal precision in the process?

Has it ever worked properly or was it always working incorrectly?
 
Upvote 0
I'm sorry. I guess I'm not quite following what you're saying. I built a module for the master sheet. It does the following: clears the cells, compares dates and categories on all the sheets, then based on the answers compiles the totals into the cells and adds them. Is there a simple code that I could add to the master sheet that would prevent it from rounding or code I need to incorporate on the individual sheets?
 
Upvote 0
Not really, no - neither of those. Excel and VBA won't round numbers unless you tell them to.

As a first step I would suggest that you go through your code making sure that the variables you're using are of the correct type to hold the data you're putting into them, specifically whether you're storing floating-point numbers in integer variables.
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top