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

Gurbachan 0 Tallied Votes 187 Views Share

'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)

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 2,565 "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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.