Calculation

J

John Pierce

Here's my problem. I have a spreadsheet. There are some Named Ranges.
They are LoanAmount, PurchasePrice, AppraisedValue, and LTV.
I have a button on the sheet that calculates the LTV.
The code says:
Dim LoanAmount As Single, PurchasePrice As Single, etc
LoanAmount = Range("LoanAmount").Value etc
Range("LTV").Value = LoanAmount / AppraisedValue
I have a cell with the formula
=IF(LTV<>"",IF(LTV>80%,"PMI Needed","PMI NOT needed"))
However, when LoanAmount = 80,000 and AppraisedValue = 100,000
the value that appears in Range LTV is 80.000% (as formatted)
but I see "PMI Needed" because the real value of the calculation
is 80.0000011920928% which appears in the formula bar.
Any ideas?
 
B

Bob Phillips

Try rounding your calculation to a set number of dec places, either as you
calculate, or the final result, or even in the worksheet formula

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
C

Charles Williams

Try using double instead of single.

But floating point arithmetic (which is what is being used) always has the
difficulty that decimal numbers do not translate exactly so you get
precision problems: I would recommend using a tolerance for your 80% ie use


Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm
 

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