calculator

kshitij_dch

Active Member
Joined
Apr 1, 2012
Messages
362
Office Version
  1. 365
  2. 2016
  3. 2007
Platform
  1. Windows
I have a table in which i have tenure in months in column A from 1 month to 60 months.


I have categorize months in 3 parts , (12 - 23) , (24-35) and (36 to 60)


(12-23) is 8%
(24-35) is 8.15%
(36-60) is 8.75%


I need to build a calculator with the help of macro that will calculate premium generated.


I have build a user form in which 2 labels are "Tenure in months" and "Amount Deposited"


Tenure in months has a input box
Amount Deposited has a input box


I am looking to build a macro in which user will enter "Tenure in months" in the input box and Amount Deposited in Input Box and presses Command button


Macro will calculate his Premium Amount according to categorization


Example , User inputs "Tenure in months" as 15 and Amount Deposited as 25000


Macro will calculate it as 25000*8% that is 2000 is the premium Amount will be displayed in Sheet 1 C3
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try the below code … Note that you haven't specified any rate for tenures less than 12

Code:
Sub Calculate()
Dim Amount As Double, Tenure As Double, Rate As Double
Amount = InputBox("Enter Amount Here ...")
Tenure = InputBox("Enter Tenure Here ...")
Select Case Tenure
    Case 12 To 23: Rate = 8 / 100
    Case 24 To 35: Rate = 8.15 / 100
    Case 36 To 60: Rate = 8.75 / 100
End Select
Sheet1.Range("C3") = Amount * Rate
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top