Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Rounding Problem

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default Rounding Problem

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

"Mike H." wrote:

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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rounding Problem?? Cleej Excel Discussion (Misc queries) 1 May 9th 08 09:17 PM
Problem with rounding? AmImad? Excel Discussion (Misc queries) 13 October 18th 07 04:34 PM
Rounding Problem Alfred Kaufmann New Users to Excel 8 September 3rd 07 11:22 PM
Rounding Problem PWS Excel Worksheet Functions 5 March 9th 07 05:21 PM
Rounding off problem..! Neo1 Excel Worksheet Functions 3 March 15th 06 11:56 PM


All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"