Select Case Information Needed

R

Richard Larson

I use the following function to calculate discounts on sales volumes. It
works but will still accept entries other than integers and will usually
show a 30% discount! The last message box must have a syntax error also....
Any help would be appreciated....TIA


Function CCDiscount(ContractValue)
Select Case ContractValue
Case Is < 0
CCDiscount = "Error < 0"
Case Is < 24000
CCDiscount = 0
Case Is < 33000
CCDiscount = 0.03
Case Is < 60000
CCDiscount = 0.05
Case Is < 120000
CCDiscount = 0.09
Case Is < 210000
CCDiscount = 0.15
Case Is < 600000
CCDiscount = 0.2
Case Is >= 600000
CCDiscount = 0.3
Case Else
CCDiscount = "Error"
End Select
End Function
 
T

Tom Ogilvy

possibly

Function CCDiscount(ContractValue)
Select Case clng(ContractValue)
Case Is < 0
CCDiscount = "Error < 0"
Case Is < 24000
CCDiscount = 0
Case Is < 33000
CCDiscount = 0.03
Case Is < 60000
CCDiscount = 0.05
Case Is < 120000
CCDiscount = 0.09
Case Is < 210000
CCDiscount = 0.15
Case Is < 600000
CCDiscount = 0.2
Case Is >= 600000
CCDiscount = 0.3
Case Else
CCDiscount = "Error"
End Select
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top