How to Find RD Muture value (Yearly,Half yearly,Quarterly, Monthly)

Gurbachan

'call it like
List1.Clear
List1.AddItem RDMature(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), 12)
List1.AddItem RDMature(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), 2)
List1.AddItem RDMature(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), 4)
List1.AddItem RDMature(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), 1)

152 Views
About the Author
Function RDMature(P As Double, Rate As Double, TimePeriod As Double, Y1H2Q4M12 As Integer) As String
Dim NakliRate As Double, NakliTime As Double, Amount As Double
Select Case Y1H2Q4M12
Case 1
NakliRate = 0.01 * Rate / Y1H2Q4M12: NakliTime = TimePeriod * Y1H2Q4M12
Amount = P * 12 * (1 + NakliRate) * ((1 + NakliRate) ^ NakliTime - 1)
RDMature = Round(Amount / (NakliRate), 2) & " Yearly"
Case 2
NakliRate = 0.01 * Rate / Y1H2Q4M12: NakliTime = TimePeriod * Y1H2Q4M12
Amount = P * 6 * (1 + NakliRate) * ((1 + NakliRate) ^ NakliTime - 1)
RDMature = Round(Amount / (NakliRate), 2) & " Half Yearly"
Case 4
NakliRate = 0.01 * Rate / Y1H2Q4M12: NakliTime = TimePeriod * Y1H2Q4M12
Amount = P * 3 * (1 + NakliRate) * ((1 + NakliRate) ^ NakliTime - 1)
RDMature = Round(Amount / (NakliRate), 2) & " Quartely "
Case 12
NakliRate = 0.01 * Rate / Y1H2Q4M12: NakliTime = TimePeriod * Y1H2Q4M12
Amount = P * 1 * (1 + NakliRate) * ((1 + NakliRate) ^ NakliTime - 1)
RDMature = Round(Amount / (NakliRate), 2) & " Monthly "
End Select
End Function
rproffitt 1,964 "Nothing to see here." Moderator

"Reusable Code Snippet" posts should include more detail about how to use and read as a tutorial too if possible.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.