Index Match Contains?
In Sheet 1, I have a cell with something like this CAP-400-BL, and I want to search another sheet for an instance of this (there would 0 or 1 instance), but then I want to send back value in a different column in that other sheet.
SHEET 1 CAP-400-BL | 202160 <-- This is pulled from Sheet 2, based on CAP-400-BL SHEET 2 CAP-400-BL-10W-Master | Completed | 202160
I am familiar with Index-Match, but what I'm looking for (to "match" with the first column in Sheet 2) won't be a match.
So in Sheet 1, I want to use a formula that looks for the row that contains CAP-400-BL in Sheet 2 , and in Sheet 1 display 202160.
How do I incorporate a "contains" in an Index formula referencing another sheet?
Best Answer
-
One approach is to use INDEX/COLLECT. Because I don't know your column names, I will call them CAP columns that contain your CAP text strings, and Number column that contains the 202160 you want returned.
=IFERROR(INDEX(COLLECT({sheet2 Number column}, {sheet2 CAP column}, CONTAINS([sheet 1 CAP]@row, @cell)), 1),"")
I wrapped it in the IFERROR so you wouldn't receive an error in the 0 instance cases. As I have it written, it will return a blank if it doesn't find a match. If you wish it to display something else, replace the double quotes at the end with quotes around your message. Example: "my text like this"
The 1 inside the Index function is the row index number.
Does this work for you?
Kelly
Answers
-
One approach is to use INDEX/COLLECT. Because I don't know your column names, I will call them CAP columns that contain your CAP text strings, and Number column that contains the 202160 you want returned.
=IFERROR(INDEX(COLLECT({sheet2 Number column}, {sheet2 CAP column}, CONTAINS([sheet 1 CAP]@row, @cell)), 1),"")
I wrapped it in the IFERROR so you wouldn't receive an error in the 0 instance cases. As I have it written, it will return a blank if it doesn't find a match. If you wish it to display something else, replace the double quotes at the end with quotes around your message. Example: "my text like this"
The 1 inside the Index function is the row index number.
Does this work for you?
Kelly
-
Thanks so much!!!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.3K Get Help
- 423 Global Discussions
- 221 Industry Talk
- 462 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 144 Just for fun
- 59 Community Job Board
- 463 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 300 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!