Need help with a VB function
Posted by Richard A on January 23, 2002 11:35 PM
I have written the following function for use in excel;
Function test(a1, a2, a3, b1, b2, b3)
test = 0
If a1 <> "x" Then test = test + b1
If a2 <> "x" Then test = test + b2
If a3 <> "x" Then test = test + b3
End Function
It works as it is, if the cell assigned to each "a" is not equal to "x" then the value in each "b" is added to the total "test". This solution works great with a small number of items.
I would like to do a similar function for a large number of items. I'm looking for help on how to specify a range in the function, such as (a1 thru a200) instead of (a1, a2, a3, etc.), and do something like "for each a <> "x" then test = test + b".
I hope my question makes sense.
Thanks in advance for any help.