Solved

# checking multiple values in VLOOKUP not equal

Posted on 2010-08-27
397 Views
In order to check Anot equal to "Red" in a Vlookup statement, I would code   A,"<>Red".

Is there a way to check A not equal to "Red", "Green" or "Blue" in vlookup without repeating the criteria similar to A not in ("Red", "Green", "Blue")

The reason is that I am comparing the value to a value returned from a vlookup, so I did not want to have concatanated vlookups if possible
0
Question by:morinia

LVL 6

Accepted Solution

I have taken to using worksheets to perform lookups and then referencing those in formula to keep the code cleaner.

You could also create vb function to perform the lookup and return the result.

0

LVL 58

Expert Comment

You can use this
You can use this expression

ISNA(MATCH(VLOOKUP(E5,\$A\$1:\$B\$5,2,FALSE),{"Red","Blue","Green"},0))

It returns True if the vlookup returns a value that is none of Red,Green,Blue
e.g.

=IF(ISNA(MATCH(VLOOKUP(E5,\$A\$1:\$B\$5,2,FALSE),{"Red","Blue","Green"},0)),"no red green or blue", "was matched")
0

LVL 80

Assisted Solution

byundt earned 250 total points
You could also test a SUMPRODUCT formula. Using cyberkiwi's example:
=IF(SUMPRODUCT((A1:A5=E5)*(B1:B5={"red","green","blue"})),"was matched","no red, green or blue")

The SUMPRODUCT formula is a little shorter and only needs two levels of nesting (vs four for IF(ISNA(MATCH(VLOOKUP...)
0

## Featured Post

### Suggested Solutions

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.