COUNTIFS + IFERROR + MATCH?

Good afternoon,
I have two sheets I am working with, referenced here as Sheet A and Sheet B. Both sheets contain an identical column, which I will call "ID Number".
Sheet A contains another column, which I will call "ID Location". On Sheet A, there may be multiple rows with the same "ID Number", as they can be in multiple "ID Locations". So, for instance, ID Number 123 may be in ID Location A on row 1, and also listed as existing in ID Location B on row 5.
I would like a formula, if possible, in Sheet B, that checks Sheet A for a matching ID Number, and then returns the following:
If one match - return text in Sheet B column "ID Location".
If two matches - return text 'Both'.
If no match - return text 'Error'.
Hence why I believe there will be a COUNT function of some kind involved, along with an IFERROR and a MATCH function.
Is this possible?
Thank you in advance.
Best Answer
-
You would need a series of IF/COUNTIFS combos and an INDEX/MATCH.
=IF(COUNTIFS({Number}, @cell = [ID Number]@row) = 1, INDEX({Location}, MATCH([ID Number]@row, {Number}, 0)), IF(COUNTIFS({Number}, @cell = [ID Number]@row) = 0, "Error", "Both"))
Answers
-
You would need a series of IF/COUNTIFS combos and an INDEX/MATCH.
=IF(COUNTIFS({Number}, @cell = [ID Number]@row) = 1, INDEX({Location}, MATCH([ID Number]@row, {Number}, 0)), IF(COUNTIFS({Number}, @cell = [ID Number]@row) = 0, "Error", "Both"))
-
That worked! Thank you so much for your help!
-
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 66.7K Get Help
- 438 Global Discussions
- 152 Industry Talk
- 497 Announcements
- 5.3K Ideas & Feature Requests
- 85 Brandfolder
- 155 Just for fun
- 77 Community Job Board
- 509 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 307 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!