ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Loss of caluclating precision (VBA vs Excel) (https://www.excelbanter.com/excel-discussion-misc-queries/50215-loss-caluclating-precision-vba-vs-excel.html)

Alex

Loss of caluclating precision (VBA vs Excel)
 
Hello

I performed a calcualtion in an excel worksheet using the built in formula
PMT=.

If I then do that same procedure using VBA (i.e. write a sub to calculate
PMT with the same inputs and still using PMT in VBA) I get two separate
results?

Can anybody help align my VBA result to the spreadsheet result.

As I understand it, excel treats anything in a spreadsheet as a 'Double' - I
defined my variables in VBA as Double but still got a different answer.

Does anybody have any insights? FWIW, I am simply calcualting loan
repayments...

Regards


Alex

Niek Otten

Hi Alex,

Did you also declare the function itself as Double?

Why not post your code, the values and the results from both methods?

--
Kind regards,

Niek Otten

"Alex" wrote in message
...
Hello

I performed a calcualtion in an excel worksheet using the built in formula
PMT=.

If I then do that same procedure using VBA (i.e. write a sub to calculate
PMT with the same inputs and still using PMT in VBA) I get two separate
results?

Can anybody help align my VBA result to the spreadsheet result.

As I understand it, excel treats anything in a spreadsheet as a 'Double' -
I
defined my variables in VBA as Double but still got a different answer.

Does anybody have any insights? FWIW, I am simply calcualting loan
repayments...

Regards


Alex





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

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