Hello All,
So ive got a pull down menu in a cell. Depending on what item is selected from the pull down menu a constant intager will be multiplied by another user input integer in a seperate cell. the result will be reported in another cell. For example.
If the user selects "3 Inch Binder" and then reports they need 3 of them. The system must calculate that each binder is 1 dollar. thus it will report 3 dollars.
Now if they select "5 inch Binder" and again report they need 3, the system must now use the constant 1.50 per binder. and thus report the total as 4.50.
I can do this easily with nested IF loops, but i have 10 items on my list, meaning i need to use VBA.
This is my code so far....what am i doing wrong?
Function Tabs(Val As String, Quan As Integer)
If Val = "1 Tab Bank of 5" Then
Tabs = Quan * 2.5
ElseIf Val = "2 Tab Banks of 5" Then
Tabs = Quan * 5
ElseIf Val = "3 Tab Banks of 5" Then
Tabs = Quan * 7.5
ElseIf Val = "4 Tab Banks of 5" Then
Tabs = Quan * 10
ElseIf Val = "5 Tab Banks of 5" Then
Tabs = Quan * 12.5
ElseIf Val = "6 Tab Banks of 5" Then
Tabs = Quan * 15
ElseIf Val = "7 Tab Banks of 5" Then
Tabs = Quan * 17.5
ElseIf Val = "8 Tab Banks of 5" Then
Tabs = Quan * 20
ElseIf Val = "9 Tab Banks of 5" Then
Tabs = Quan * 22.5
ElseIf Val = "10 Tab Banks of 5" Then
Tabs = Quan * 25
Else
Tabs = 0
End If
End Function
This isnt working at all however.
Any Ideas? ( I have proper indention in the code itself.)
NOTE: Quan will be the user input for how many of the item they need. The constants being multiplied in the code correspond to the price per unit for that item. Hence why Quan is multiplied by the price per unit to give us the final amount to be reported in the cell where the formula is called.
Bookmarks