Decimal Places

D

David

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.
 
C

Carim

Hi,

Just use instruction :

cur_interestPart1.NumberFormat = "#,##0.0000000000000000"

HTH
 
D

David

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.
 
N

Niek Otten

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 here:

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

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

| 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top