M
myemail.an
Hi all,
I am working on an Excel template which calculates specific values
based on the bucket to which certain parameters belong. The rules are
something like:
if Param1 <= 3 Then Output = 4
if 3 < Param1 <= 7 Then Output = 6
if 7 < Param1 <= 11 Then Output = 9
if Param1 > 11 then output = 0
I have to calculate this for about 20 parameters, and for each
parameter there can be up to 12 possible outputs.
I started doing this with nested IF formulas, but it's not a very
efficient solution: not too straightforward to write, test and audit.
I could write a specific VBA function for each parameter: it would be
easier to read than nested Ifs, but not ideal: I'd like to write a
generic VBA function that takes 3 inputs:
1) Param1
2) an array of thresholds
3) an array of associated outputs
The problem is, the number of elements in the array is not fixed but
variable. Paramarray allows me to pass one vector of variable
dimension as argument to a function, but I need to use 2 arrays of
variable dimension.
Any ideas? Any help would be greatly appreciated!
Thanks!
I am working on an Excel template which calculates specific values
based on the bucket to which certain parameters belong. The rules are
something like:
if Param1 <= 3 Then Output = 4
if 3 < Param1 <= 7 Then Output = 6
if 7 < Param1 <= 11 Then Output = 9
if Param1 > 11 then output = 0
I have to calculate this for about 20 parameters, and for each
parameter there can be up to 12 possible outputs.
I started doing this with nested IF formulas, but it's not a very
efficient solution: not too straightforward to write, test and audit.
I could write a specific VBA function for each parameter: it would be
easier to read than nested Ifs, but not ideal: I'd like to write a
generic VBA function that takes 3 inputs:
1) Param1
2) an array of thresholds
3) an array of associated outputs
The problem is, the number of elements in the array is not fixed but
variable. Paramarray allows me to pass one vector of variable
dimension as argument to a function, but I need to use 2 arrays of
variable dimension.
Any ideas? Any help would be greatly appreciated!
Thanks!