Solutions PDF
Solutions PDF
Loop
' Clean up Rupees.
Select Case Rupees
Case ""
Rupees = "No Rupees"
Case "One"
Rupees = "One Rupee"
Case Else
Rupees = Rupees & " Rupees"
End Select
' Clean up Paise.
Select Case Paise
Case ""
Paise = " And No Paise"
Case "One"
Paise = " And One Paisa"
Case Else
Paise = " And " & Paise & " Paise"
End Select
ConvertCurrencyToRupees = Rupees & Paise
End Function
Private Function ConvertHundreds(ByVal MyNumber)
Dim Result As String
' Exit if there is nothing to convert.
If Val(MyNumber) = 0 Then Exit Function
' Append leading zeros to number.
MyNumber = Right("000" & MyNumber, 3)
' Do we have a hundreds place digit to convert?
If Left(MyNumber, 1) <> "0" Then
Result = ConvertDigit(Left(MyNumber, 1)) & " Hundred "
End If
' Do we have a tens place digit to convert?
If Mid(MyNumber, 2, 1) <> "0" Then
Result = Result & ConvertTens(Mid(MyNumber, 2))
Else
' If not, then convert the ones place digit.
Result = Result & ConvertDigit(Mid(MyNumber, 3))
End If
ConvertHundreds = Trim(Result)
End Function
Private Function ConvertTens(ByVal MyTens)
Dim Result As String
' Is value between 10 and 19?
If Val(Left(MyTens, 1)) = 1 Then
Select Case Val(MyTens)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else
' .. otherwise it's between 20 and 99.
Select Case Val(Left(MyTens, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
' Convert ones place digit.
Result = Result & ConvertDigit(Right(MyTens, 1))
End If
ConvertTens = Result
End Function
Private Function ConvertDigit(ByVal MyDigit)
Select Case Val(MyDigit)
Case 1: ConvertDigit = "One"
PMT(rate,nper,pv,fv,type)
For a more complete description of the arguments in PMT, see the PV function.
Pv is the present value, or the total amount that a series of future payments is worth now; also
known as the principal.
Fv is the future value, or a cash balance you want to attain after the last payment is made. If fv is
omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
Type is the number 0 (zero) or 1 and indicates when payments are due.
Data
Description
8%
10
10000
Amount of loan
Formula
Description (Result)
Monthly payment for a loan with the above terms, except payments are due at the
beginning of the period (-1,030.16)
PPMT
Returns the payment on the principal for a given period for an investment based on periodic,
constant payments and a constant interest rate.
Syntax
PPMT(rate,per,nper,pv,fv,type)
Pv is the present value the total amount that a series of future payments is worth now.
Fv is the future value, or a cash balance you want to attain after the last payment is made. If fv is
omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
0 or omitted
Remark
Make sure that you are consistent about the units you use for specifying rate and nper. If you make
monthly payments on a four-year loan at 12 percent annual interest, use 12%/12 for rate and 4*12
for nper. If you make annual payments on the same loan, use 12% for rate and 4 for nper.
Example 1
Data
Description (Result)
10%
2000
Amount of loan
Formula
Description (Result)
NOTE
The interest rate is divided by 12 to get a monthly rate. The number of years the money is
IPMT
Returns the interest payment for a given period for an investment based on periodic, constant
payments and a constant interest rate.
Syntax
IPMT(rate,per,nper,pv,fv,type)
Per is the period for which you want to find the interest and must be in the range 1 to nper.
Pv is the present value, or the lump-sum amount that a series of future payments is worth right
now.
Fv is the future value, or a cash balance you want to attain after the last payment is made. If fv is
omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
Type is the number 0 or 1 and indicates when payments are due. If type is omitted, it is assumed
to be 0.
Set type equal to
Remarks
Make sure that you are consistent about the units you use for specifying rate and nper.
If you make monthly payments on a four-year loan at 12 percent annual interest, use 12%/12
for rate and 4*12 for nper. If you make annual payments on the same loan, use 12% for rate
and 4 for nper.
For all the arguments, cash you pay out, such as deposits to savings, is represented by
negative numbers; cash you receive, such as dividend checks, is represented by positive
numbers.
Example
Data
Description
10%
Annual interest
Years of loan
8000
Formula
Description (Result)
Interest due in the first month for a loan with the terms above (-22.41)
Interest due in the last year for a loan with the terms above, where payments
are made yearly (-292.45)
Note The interest rate is divided by 12 to get a monthly rate. The years the money is paid out is
multiplied by 12 to get the number of payments.
1. Concatenating qualifications:
Function QfyConcat(x As Range, y As Range) As String
Dim vstr1 As String
Dim vstr2 As String
a=3
vstr1 = y.Value
For Each rw In x.Rows
If vstr1 = x.Cells(a) Then
vstr2 = (vstr2) & (x.Cells(a + 1) & IIf(vstr1 = x.Cells(a + 2), ", ", ""))
End If
a=a+2
Next rw
QfyConcat= vstr2
End Function