Vlookup and IF?

G

Guest

I am using vlookup to calculate a value which is wroking great. However, if
another cell has a zero value, I want my vlookup cell to be zero as well.

cell D22...=VLOOKUP(D18,B33:C49,2)

I want to add to the above formula... if another cell (D21) calculation
result is zero, make this cell (D22) zero as well.

What would the new formula be?

Thank you!
Vance
 
S

Sandy Mann

=IF(D21=0,0,VLOOKUP(D18,B33:C49,2))

This however will return zero even in D21 is empty. To avoid that then use:

=IF(D21="","",IFD21=0,0,VLOOKUP(D18,B33:C49,2)))

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
(e-mail address removed) with @tiscali.co.uk
 
G

Guest

Thank you Sandy - that worked perfect!
--
Vance


Sandy Mann said:
=IF(D21=0,0,VLOOKUP(D18,B33:C49,2))

This however will return zero even in D21 is empty. To avoid that then use:

=IF(D21="","",IFD21=0,0,VLOOKUP(D18,B33:C49,2)))

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
(e-mail address removed) with @tiscali.co.uk
 
S

Sandy Mann

You're very welcome - hope that you did not try to use the 2nd formula
because I see that I left out an opening parenthesis. It should have been

=IF(D21="","",IF(D21=0,0,VLOOKUP(D18,B33:C49,2)))

So much for editing in the post without testing!

--
Regards,

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
(e-mail address removed) with @tiscali.co.uk
 

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

Similar Threads


Top