IF(MATCH with Multiple Criteria Across Sheets

I am attempting to create a formula that will search another sheet for a product code and as long as the product code isn't listed as "Canceled" on the other sheet, return "Yes".
I started with =IF(CONTAINS([Product Code]@row, {Upcoming Products}), "YES", "NO").
When I tried to add the condition, I got a little lost on how to add both criteria. Looking through articles, this is what I ended up with =IF(ISERROR(MATCH([Product Code]@row, {Upcoming Products}, 0)), "NO", AND(IF(MATCH([Product Code]@row, {Upcoming Products}, 0), IF(NOT(INDEX(COLLECT({Status}) = "Canceled")), "NO", "YES"))))
I've attached sample data pictures to help explain
Answers
-
Try counting how many rows have that product code and "Cancelled". If that count is greater than zero then the product code has been cancelled.
=IF(COUNTIFS({Code}, @cell = [Product Code]@row, {Status}, @cell = "Cancelled") > 0, "NO", "YES")
-
@Paul Newcome Thank you for solving the "Canceled" portion of the formula! I had to add it into the original formula so that it didn't put "Yes" for Product Codes that weren't matched across both sheets.
=IF(NOT(CONTAINS([Product Code]@row, {Upcoming Products})), "NO", IF(COUNTIFS({Upcoming Products}, @cell = [Product Code]@row, {Status}, @cell = "Canceled") > 0, "NO", "YES"))
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 67.4K Get Help
- 464 Global Discussions
- 156 Industry Talk
- 509 Announcements
- 5.4K Ideas & Feature Requests
- 86 Brandfolder
- 156 Just for fun
- 81 Community Job Board
- 518 Show & Tell
- 35 Member Spotlight
- 3 SmartStories
- 307 Events
- 35 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!