how i can call the function

G

Guest

Hi .... i have a problem that how i can call a function in Excel VBA the
problem is.

public function price(item)

if(item = "apple") then
price =10
tax=0.2
elseif(item="orange") then
price =8
tax=0.5
end if
end function

But now how to get the exact tax number of apple which is 0.2
thanks in advance
 
B

Bob Phillips

set up a table like so in say H1:K20

item price tax
apple 10 0.2
orange 8 .5
etc.

and us

=vlookup(A1,$H$1:$K$20,2,False)*VLOOKUP(A1,$H$1:$K$20,3,False)
--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Top