Vlookup formula that excludes certain values from the range

Hi!

I need to use a simple vlookup formula such as:
 =IFERROR(VLOOKUP($B66,'A Pivot'!$A$5:$G$5087,2,FALSE),"") ...the only addition that I need to have is to exclude the following values from the range:
1691; 5201; 5214 & 5206....(my list of these values is longer but I hope to the my point to you)

How should my formula be modified?

thanks,
LadkissonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

barry houdiniCommented:
I'm not sure I understand what you mean by "Exclude the following values from the range". Do you mean those values shouldn't be results of the VLOOKUP? What should happen instead?

regards, barry
0
LadkissonAuthor Commented:
the column I am referencing in my range should exclude the values I mentioned above...instead it should give me something like "not needed"
0
barry houdiniCommented:
OK, I assume you mean that if B66 is one of those values then show "not needed". Try listing the exclusion values on the worksheet, e.g. in Z2:Z10 and then using this version

=IFERROR(IF(COUNTIF($Z$2:$Z$10,$B66),"Not needed",VLOOKUP($B66,'A Pivot'!$A$5:$G$5087,2,FALSE)),"")

regards, barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.