Newbe help - VBA function

  • Thread starter Thread starter Kristen
  • Start date Start date
K

Kristen

Newbe needs help

I'm creating a function for Excel.
I want the function to operate two different ways depending on the
contents of a sell.

Like
If cell A1 (AB in VBA function ) is A then Va * Vb
If cell A1 (AB) is B then Va * Vc


In Excel IF function terms I'm wanting to:

=IF(AB = "A",Va*Vb,IF(AB = "B",Va*Vc,"-"))

So what should my function be in VBA:
Function test(AB, Va, Vb, Vc)
?? where to from here

Thankyou for your help
Kristen
 
Function test(AB,Va,Vb,Vc)
IF AB="A" then
test=Va * Vb
ElseIf AB = "B" then
test = Va * Vc
Else
test = "-"
End If
End Function

Bob Umlas
Excel MVP
 
Back
Top