View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ra ra is offline
external usenet poster
 
Posts: 27
Default User Defined Function

On 26 Feb, 20:45, RadarEye wrote:
Hi ra,

It is not completely clear to me want you are looking for.

I have cooked a function which returns the values from your table:

Function raQuestion(SalesGrowth As Double, Tier As Integer) As Double
* * Select Case SalesGrowth
* * * * Case Is <= 0.03
* * * * * * raQuestion = 0
* * * * Case 0.0301 To 0.05
* * * * * * Select Case Tier
* * * * * * * * Case 1: raQuestion = 0.001
* * * * * * * * Case 2: raQuestion = 0.002
* * * * * * * * Case 3: raQuestion = 0.003
* * * * * * End Select
* * * * Case 0.0501 To 0.1
* * * * * * Select Case Tier
* * * * * * * * Case 1: raQuestion = 0.002
* * * * * * * * Case 2: raQuestion = 0.006
* * * * * * * * Case 3: raQuestion = 0.008
* * * * * * End Select
* * * * Case 0.1001 To 0.15
* * * * * * Select Case Tier
* * * * * * * * Case 1: raQuestion = 0.003
* * * * * * * * Case 2: raQuestion = 0.01
* * * * * * * * Case 3: raQuestion = 0.013
* * * * * * End Select
* * * * Case 0.1501 To 0.2
* * * * * * Select Case Tier
* * * * * * * * Case 1: raQuestion = 0.004
* * * * * * * * Case 2: raQuestion = 0.014
* * * * * * * * Case 3: raQuestion = 0.018
* * * * * * End Select
* * * * Case Is 0.2
* * * * * * Select Case Tier
* * * * * * * * Case 1: raQuestion = 0.005
* * * * * * * * Case 2: raQuestion = 0.02
* * * * * * * * Case 3: raQuestion = 0.025
* * * * * * End Select
* * End Select
End Function

HTH,


Thank you! that works exactly. The problem I was having was using two
variables however I can see where I was going wrong now. Always good
to learn something new, cheers.