Home » excel » excel conditional formatting vlookup does not contain value

excel conditional formatting vlookup does not contain value

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a formular for conditional formatting:

=VLOOKUP(H4;Anothersheet.A$4:$A$20;1;FALSE)=H4

When the value of H4 is found in the given range Anothersheet.A$4:$A$20, the cell gets colored in red. But I want to color the cell red if the value is not found. How can i achieve this?

I have tried the following formulars:

  • =VLOOKUP(H4;Anothersheet!$A$4:$A$20;1;FALSE)<>H4
  • =NOT(VLOOKUPH4;Anothersheet!$A$4:$A$20;1;FALSE)=H4)

But this doesn’t work. In both cases the cell does not get colored (if the value exists in the given range and if the value does not exist in the given range).

How to&Answers:

User COUNTIF() for this:

=COUNTIF(Anothersheet!$A$4:$A$20,H4)=0

When not found your VLOOKUP() returns #N/A.

That being said, you can also edit your formula into:

=ISERROR(VLOOKUP(H4;Anothersheet!$A$4:$A$20;1;FALSE))