Vlookup and IF?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
=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
 
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
 
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
 
Back
Top