Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Roundup, round, round down
Message
De
23/11/1998 13:05:31
 
 
À
21/11/1998 16:26:03
Information générale
Forum:
Microsoft Office
Catégorie:
Excel
Divers
Thread ID:
00160221
Message ID:
00160569
Vues:
18
>>When comparing the number from our business application written in Visual FoxPro, we have come accros a problem that we find disturbing.
>>
>>
>>In the following, Excel is adding the true value of the numbers before it rounds to 2 decimals.
>>
>>Excel
>>
>>520.0000
>>238.6350
>>127.3756
>>456.2375
>>--------
>1342.2481
>
>FoxPro
>
>520.00
>238.64
>127.38
>456.24
>------
>1342.26
>>
>>
>>The cells in Excel are formatted to "Currency" which shows 2 decimals by default. The value of the cells is a sum of a calculation. example: =A1*B1 etc...
>>
>>The Foxpro figures are added using the totals after rounding.
>>
>>Which are the currect figures to use? Or how do you make Excel round to the 2 decimal before it adds the figures.
>>
>>Please let me know if this an Excel bug or are we attempting to be to close with the numbers.

This is not a bug; currency, even though it only displays to 2 places, is stored internally with more (I believe it's 4 decimal places.) To force Excel to round before adding, apply the ROUND() function to the cell before adding it, or SUM the ROUND()ed values.


>>
>>Thank You
>>stripe@cybertron.com
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform