Using nested MATCH/INDEX across multiple columns

Joshua Peacock
Joshua Peacock ✭✭✭
edited 12/09/19 inFormulas and Functions

Hi,

I'm using two sheets to track the distribution of transportation gift cards, one will be a master list of the cards and the other is a webform tracker that distribution partners use to log who receives cards.

I want the master list to check off each card given out after it is logged into the tracker, however each recipient may receive 1-7 cards so I need the master list to pull from the entire tracker to find the card. The tracker webform needs to be centered around the recipient so each row is another person, not another card.

I am able to do what I need with one column, but I cannot figure out how to get it to work across the table. Here's what the webform sheet looks like:

Resources Issued

The master list is using the nested function to label who was given each card by card number, then checks off that the card has been given out (the current function just checks Resource Type 1 in the webform sheet so I can show you what I've done so far):

Master list

I originally tried searching the entire table with the MATCH function, but it just ended up a mess looking like this (everything is the same as the function in the second picture, just the range in the MATCH):

MATCH over whole table

Not really sure how to get this to work, could use your thoughts.

Answers

  • Picture is kind of small so here is the function in the second screenshot:

    =INDEX({Pilot Resources Issued Client Names}, MATCH([Card Number]1, {Resource 1}, 0))

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    edited 01/25/19

    You could try using an IF statement to determine which range you want the match to look at. Something along the lines of...

    =IF(COUNTIFS({Resource 1},@cell= [Card Number]@row)> 0, INDEX({Pilot Resources Issued Client Names}, MATCH([Card Number]@row, {Resource 1}, 0)), INDEX({Pilot Resources Issued Client Names}, MATCH([Card Number]@row, {Resource 2}, 0)))

    Basically this says to count how many times that card number appears in the {Resource 1} range. If it is more than 0 times meaning it exists in {Resource 1}, then it will run the INDEX/MATCH on {Resource 1}. Otherwise it will run it on {Resource 2}.

  • Hi Paul,

    Thanks for the advice. When I plug in the text you gave me it comes back as #UNPARSEABLE though. Would I need to change the first@rowto be the specific Card number in the Resource Tracker? I haven't used @ before so I'm not 100% that I am using it correctly.

    Thanks!

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Joshua,

    这里的每一块的公式:

    {Resource 1}: Cross sheet reference to the [Resource 1 Code Number] column on the Pilot Resources Issued sheet.

    @cell: Leave as is. This basically gives the formula something specific to refer to when looking at the {Resource 1} range.

    [Card Number]@row: Leave as is. This is saying to refer to whatever row the formula is on in the [Card Number] column in the Transportation Pilot Resource Tracker sheet.

    {Pilot Resources Issued Client Names}: Cross sheet reference to what I assume is the [Pilot Resources Issued Client Names] column on the Pilot Resources Issued sheet. I pulled it from your original formula assuming that column was housing the name you were trying to pull.

    [Card Number]@row: See Above.

    {Resource 1}: See Above.

    {Pilot Resources Issued Client Names}: See Above.

    [Card Number]@row: See Above.

    {Resource 2}: Cross sheet reference to the [Resource 2 Code Number] column on the Pilot Resources Issued sheet.

    The way my formula works is that it first looks at the Resource 1 column. If the card number is there, it runs an INDEX/MATCH on that row to pull the appropriate name. If the card number is not in the Resource 1 column, it will run an INDEX/MATCH on whatever row the card number shoes up in the Resource 2 column to pull the appropriate row.

    The problem with your initial formula is that you are looking at multiple columns but not specifying which one to pull from. What I did is broke it down into two separate INDEX/MATCH formulas (one for range 1/one for range 2) and then used an IF statement to say that if the first one doesn't work, do the second one.

    Hopefully this helps you tweak it so that it will work for you. You do need to properly establish each of the cross sheet references as well. If you are just typing in what I have, but not designating a range for the reference, the formula won't know where to look.

  • Ah, thank you for the explanation!

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
  • @Paul NewcomeFirst, let me say thank you so much for breaking down the explanation. I have this working for two columns but I'm wondering if I could get a third. I've done it a few ways but can't quite figure it out. I'm sure that I must be getting the punctuation wrong. Could you explain how to add another column to the formula?

    This works: =IF(COUNTIFS({FY 2023 Vacancy Tracking Reference1|Posting Number}, @cell = [Posting Number]@row) > 0, INDEX({FY 2023 Vacancy Tracking | Sent to Office}, MATCH([Posting Number]@row, {FY 2023 Vacancy Tracking Reference1|Posting Number}, 0)), INDEX({FY 2023 Vacancy Tracking | Sent to Office}, MATCH([Posting Number]@row, {FY 2023 Vacancy Tracking Reference 2|Alt #}, 0)))

    But this one doesn't look at the second or third column: =IF(COUNTIFS({FY 2023 Vacancy Tracking Reference1|Posting Number}, @cell = [Posting Number]@row) > 0, INDEX({FY 2023 Vacancy Tracking | Sent to Office}, MATCH([Posting Number]@row, {FY 2023 Vacancy Tracking Reference1|Posting Number}, 0)), INDEX({FY 2023 Vacancy Tracking | Sent to Office}, MATCH([Posting Number]@row, {FY 2023 Vacancy Tracking Reference 2|Alt #}, INDEX({FY 2023 Vacancy Tracking | Sent to Office}, MATCH([Posting Number]@row, {FY 2023 Vacancy Tracking Reference 3|Alt Number}, 0)))))

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    @AmberDEPHRI'm not sure I follow. Are you referring to the second range/criteria set inside each of the MATCH functions?

  • I was doing the same thing the person that asked the initial question was doing. I was able to use your explanation to create my formula. It works for the first two, but when I add a third "MATCH([Posting Number]@row, {FY 2023 Vacancy Tracking Reference 3|Alt Number}, 0)))))" it breaks.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    @AmberDEPHRIt looks like maybe you forgot to close out a piece. Try moving some closing parenthesis from the end to finish out the part inBOLD.


    =IF(COUNTIFS({FY 2023 Vacancy Tracking Reference1|Posting Number}, @cell = [Posting Number]@row) > 0, INDEX({FY 2023 Vacancy Tracking | Sent to Office}, MATCH([Posting Number]@row, {FY 2023 Vacancy Tracking Reference1|Posting Number}, 0)), INDEX({FY 2023 Vacancy Tracking | Sent to Office}, MATCH([Posting Number]@row, {FY 2023 Vacancy Tracking Reference 2|Alt #}, INDEX({FY 2023 Vacancy Tracking | Sent to Office}, MATCH([Posting Number]@row, {FY 2023 Vacancy Tracking Reference 3|Alt Number}, 0)))))

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the公式手册模板!
@Kris Peeters<\/a> <\/p>

you should be able to use =Countifs([Al Javor]@row:[Lisa Young]@row,\"1 - High\")<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":108307,"type":"question","name":"Formula to Average Performance Score for Various Service Categories","excerpt":"I am trying to create a formula that averages the performance score of various service categories. For example, whenever the service category (drop down box) has \"civil engineer\" selected, I want a running formula that averages all the civil engineer ratings. I have tried using the =averageif() formula, but I continue to…","snippet":"I am trying to create a formula that averages the performance score of various service categories. For example, whenever the service category (drop down box) has \"civil engineer\"…","categoryID":322,"dateInserted":"2023-07-31T15:35:13+00:00","dateUpdated":"2023-07-31T15:48:17+00:00","dateLastComment":"2023-07-31T18:57:50+00:00","insertUserID":164346,"insertUser":{"userID":164346,"name":"ullkay95","url":"https:\/\/community.smartsheet.com\/profile\/ullkay95","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!bmtAmxLQVL0!e6DCx07vJ9c!25n9oP55COS","dateLastActive":"2023-07-31T18:59:28+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":164346,"lastUserID":45516,"lastUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-07-31T19:57:04+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":11,"countViews":35,"score":null,"hot":3381654183,"url":"https:\/\/community.smartsheet.com\/discussion\/108307\/formula-to-average-performance-score-for-various-service-categories","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108307\/formula-to-average-performance-score-for-various-service-categories","format":"Rich","lastPost":{"discussionID":108307,"commentID":388084,"name":"Re: Formula to Average Performance Score for Various Service Categories","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/388084#Comment_388084","dateInserted":"2023-07-31T18:57:50+00:00","insertUserID":45516,"insertUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-07-31T19:57:04+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/2HQ91LNQF3GG\/screenshot-2023-07-31-114610.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"Screenshot 2023-07-31 114610.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-07-31T18:52:12+00:00","dateAnswered":"2023-07-31T18:48:05+00:00","acceptedAnswers":[{"commentID":388078,"body":"

In that case you would use the same syntax but you would reference the column in the sheet using the appropriate column name. <\/p>

[Column name]:[Column name]<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":108204,"type":"question","name":"I am trying to return where a contract is in the review process, DOJ review may or may not have date","excerpt":"=IF(Started@row > [To OC&P]@row, \"HSD Contracts\", IF([To OC&P]@row > DOJ@row, \"OC&P\", IF(OR(DOJ@row > [To Contractor]@row, \"DOJ\", IF(DOJ@row = 0, IF([To Contractor]@row > [To OC&P]@row, \"Out for Signature\"), IF([To Contractor]@row > [HSD Signed]@row, \"Out for Signature\", \"//www.santa-greenland.com/community/discussion/39821/\"))))))","snippet":"=IF(Started@row > [To OC&P]@row, \"HSD Contracts\", IF([To OC&P]@row > DOJ@row, \"OC&P\", IF(OR(DOJ@row > [To Contractor]@row, \"DOJ\", IF(DOJ@row = 0, IF([To Contractor]@row > [To…","categoryID":322,"dateInserted":"2023-07-27T17:35:54+00:00","dateUpdated":"2023-07-27T17:36:30+00:00","dateLastComment":"2023-08-01T00:09:58+00:00","insertUserID":164200,"insertUser":{"userID":164200,"name":"mjmitchell","title":"DBO","url":"https:\/\/community.smartsheet.com\/profile\/mjmitchell","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-01T00:06:31+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":91566,"lastUserID":164200,"lastUser":{"userID":164200,"name":"mjmitchell","title":"DBO","url":"https:\/\/community.smartsheet.com\/profile\/mjmitchell","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-01T00:06:31+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":4,"countViews":52,"score":null,"hot":3381330352,"url":"https:\/\/community.smartsheet.com\/discussion\/108204\/i-am-trying-to-return-where-a-contract-is-in-the-review-process-doj-review-may-or-may-not-have-date","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108204\/i-am-trying-to-return-where-a-contract-is-in-the-review-process-doj-review-may-or-may-not-have-date","format":"Rich","lastPost":{"discussionID":108204,"commentID":388134,"name":"Re: I am trying to return where a contract is in the review process, DOJ review may or may not have date","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/388134#Comment_388134","dateInserted":"2023-08-01T00:09:58+00:00","insertUserID":164200,"insertUser":{"userID":164200,"name":"mjmitchell","title":"DBO","url":"https:\/\/community.smartsheet.com\/profile\/mjmitchell","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-01T00:06:31+00:00","banned":0,"punished":0,"private":false,"label":"✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-01T00:10:04+00:00","dateAnswered":"2023-08-01T00:09:58+00:00","acceptedAnswers":[{"commentID":388134,"body":"

This took me a few hours to finally figure out and clearly, I have much to learn related to SmartSheet function rules. This is the final formula that worked. Sharing in case others may have a similar need. <\/p>

=IF(AND(ISBLANK(DOJ@row), ISDATE([To Contractor]@row)), \"Out for Signature\", IF(Started@row > [To OC&P]@row, \"HSD Contracts\", IF([To OC&P]@row > DOJ@row, \"OC&P\", IF(DOJ@row > [To Contractor]@row, \"DOJ\", IF([To Contractor]@row > [HSD Signed]@row, \"Out for Signature\", IF(DOJ@row <> [To Contractor]@row, \"Out for Signature\"))))))<\/p>

Once tested, this can be converted to column formula.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=322&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":10000,"limit":3},"title":"Trending in Formulas and Functions ","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

Trending in Formulas and Functions