ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Decimal Places (https://www.excelbanter.com/excel-programming/402750-decimal-places.html)

David

Decimal Places
 
Hi

I've a calculation in Excel VBA and it defaults to giving the result
up to 11 decimal places. I need it to be accurate to 16 decimal
places. Can this be done and if so how?

Here's the calculation:

cur_interestPart1 = (cur_balance - cur_offset_amount) * ((int_rate1 /
365) * (int_days_of_interest - int_days_of_interest_hols))

Thanks.

Carim

Decimal Places
 
Hi,

Just use instruction :

cur_interestPart1.NumberFormat = "#,##0.0000000000000000"

HTH

David

Decimal Places
 
Hi, thanks but I get an error:

"Compile Error: Invalid Qualifier"

The variables had been dimensioned as doubles, so I commented out
those lines and now I get:

"Object required"

Any ideas? Thanks.


Niek Otten

Decimal Places
 
Hi David,

Excel's precision is 15 decimal digits. So if the integer part of the number is 4 places, there's only 11 left for the fraction.

Look he

http://www.cpearson.com/excel/rounding.htm

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"David" wrote in message ...
| Hi
|
| I've a calculation in Excel VBA and it defaults to giving the result
| up to 11 decimal places. I need it to be accurate to 16 decimal
| places. Can this be done and if so how?
|
| Here's the calculation:
|
| cur_interestPart1 = (cur_balance - cur_offset_amount) * ((int_rate1 /
| 365) * (int_days_of_interest - int_days_of_interest_hols))
|
| Thanks.




All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com