LookUp and Match a value located in a cell with multiple values and return single and/or multiple va

MarcRNelson
MarcRNelson ✭✭✭
edited 12/09/19 inFormulas and Functions

Hi,

I am hoping someone can help with this formula. I was able to get this working using VLOOKUP when there were fewer complexities.

In Sheet 2 when there is a value in the "Lot Number" cell,

  • The formula should look at Sheet 1 to see if the "Lot Number" matches and exists in any of the cells located under the Lot Number column.
  • If the "Lot Number" does exist add the "Event Ref No" associated with the "Lot Number" to Sheet 2.
  • If the "Lot Number" is listed in more than one cell in Sheet 1 under the Lot Number column, the formula should capture each "Event Ref No" that is associated with the lot number, and concatenate them into the "Event Ref No" Cell associated with the lot number.
  • If the lot number does NOT exist in Sheet 1 then "NO Event Ref No Found" should be added in the associated "Event Ref No" cell in Sheet 2.

In Sheet 2 when there is blank or no value in the "Lot Number" cell,

  • If the Lot number in Sheet 2 is blank do not do return any value. This is because in Sheet 1 there may be an Event Ref No but the Lot Number may be listed right away so I do not want it to start pulling values for blanks.

Oh boy, oh boy!

Image.PNG

Comments

  • L_123
    L_123 ✭✭✭✭✭✭

    Yeah, you don't want to use vlookup.

    https://help.smartsheet.com/function/collect

    use

    Join(Collect())

    =join(collect([Even Ref Number]:[Event Ref Number],[Lot Number]:[Lot Number],[Lot Number Searching For]@row),",")

    Of course you are going to have to change the ranges to your sheet references and correct column names. I attempted to make this at least somewhat clear what you need to use. Make sure to have this part working before moving on, as the rest is based off this.

    Now we have the heart of your equation we can tackle the easier part. We can add some if statements that are somewhat redundant. for right now, I am going to refer to the above equation as FORMULAX, to make this shorter and easier to understand. Make sure you play around with the above formula and understand it before going to this part.

    =if([Lot Number Searching For] = "", "", if(FORMULAX = "", "No Event Ref No Found", FORMULAX))

    Collect is one of the most versatile and strongest formulas that smartsheet has. It is also one of the hardest to understand at first. Be sure to take your time, and read the help page if you have any problems implementing this formula.

  • Hi Marc,

    Did you solve your Problem? If so, with which formular did you get multiple Event Ref No in your Sheet 2? e.g. 12345 results in 6540, 9499, 2222!

    I am facing the same problem.

    Paul

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the公式手册模板!
You would have to insert a new header field into the form that has that particular verbiage formatted the way you want then use the form field logic to display this header row if one of the incorrect answers is selected.<\/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":108403,"type":"question","name":"Date formula to set cut off period","excerpt":"I am trying to set a date formula to for the following statement; if the [Next Due Date] is <= 27\/07\/2023 return \"Performed\" Example: =IF(ISBLANK([Last inspection]@row), \"\", IF(DATE(2023,7,27)) < [Next Due Date]@row, \"Overdue\", \"Performed\"))","snippet":"I am trying to set a date formula to for the following statement; if the [Next Due Date] is <= 27\/07\/2023 return \"Performed\" Example: =IF(ISBLANK([Last inspection]@row), \"\",…","categoryID":322,"dateInserted":"2023-08-02T11:05:55+00:00","dateUpdated":"2023-08-02T11:35:37+00:00","dateLastComment":"2023-08-03T08:51:04+00:00","insertUserID":125711,"insertUser":{"userID":125711,"name":"Adedeji Adebanjo","url":"https:\/\/community.smartsheet.com\/profile\/Adedeji%20Adebanjo","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ZrfDGXkxfL4!BfDCQc0uMJQ!nMYqiMpYuek","dateLastActive":"2023-08-03T10:26:54+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭"},"updateUserID":91566,"lastUserID":125711,"lastUser":{"userID":125711,"name":"Adedeji Adebanjo","url":"https:\/\/community.smartsheet.com\/profile\/Adedeji%20Adebanjo","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ZrfDGXkxfL4!BfDCQc0uMJQ!nMYqiMpYuek","dateLastActive":"2023-08-03T10:26:54+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":19,"score":null,"hot":3382028219,"url":"https:\/\/community.smartsheet.com\/discussion\/108403\/date-formula-to-set-cut-off-period","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108403\/date-formula-to-set-cut-off-period","format":"Rich","lastPost":{"discussionID":108403,"commentID":388644,"name":"Re: Date formula to set cut off period","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/388644#Comment_388644","dateInserted":"2023-08-03T08:51:04+00:00","insertUserID":125711,"insertUser":{"userID":125711,"name":"Adedeji Adebanjo","url":"https:\/\/community.smartsheet.com\/profile\/Adedeji%20Adebanjo","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ZrfDGXkxfL4!BfDCQc0uMJQ!nMYqiMpYuek","dateLastActive":"2023-08-03T10:26:54+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-03T08:50:18+00:00","dateAnswered":"2023-08-02T12:58:11+00:00","acceptedAnswers":[{"commentID":388454,"body":"

Try removing one of the closing parenthesis after the DATE function.<\/p>"},{"commentID":388644,"body":"

Thanks! That sorted it!😀<\/span><\/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":108438,"type":"question","name":"NETWORKDAYS WITH AN IF??","excerpt":"Can anyone help with a formula to track the number of days between 2 separate columns with the IF of stopping the count once a date is populated in one of those columns?","snippet":"Can anyone help with a formula to track the number of days between 2 separate columns with the IF of stopping the count once a date is populated in one of those columns?","categoryID":322,"dateInserted":"2023-08-02T19:37:00+00:00","dateUpdated":null,"dateLastComment":"2023-08-02T20:11:28+00:00","insertUserID":164426,"insertUser":{"userID":164426,"name":"JT_22002","url":"https:\/\/community.smartsheet.com\/profile\/JT_22002","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-03T11:32:53+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":161714,"lastUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-03T12:32:35+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":1,"countViews":19,"score":null,"hot":3382012708,"url":"https:\/\/community.smartsheet.com\/discussion\/108438\/networkdays-with-an-if","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108438\/networkdays-with-an-if","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":108438,"commentID":388600,"name":"Re: NETWORKDAYS WITH AN IF??","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/388600#Comment_388600","dateInserted":"2023-08-02T20:11:28+00:00","insertUserID":161714,"insertUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-03T12:32:35+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-03T11:34:23+00:00","dateAnswered":"2023-08-02T20:11:28+00:00","acceptedAnswers":[{"commentID":388600,"body":"

I'm not sure I understand the goal. If you want to see the days between two column, you will need to already have a date in each of those columns. This seems to contradict stopping the count once one of the columns is populated. Can you provide more detail, or maybe a screenshot\/mockup of what you are looking for?<\/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":[{"tagID":254,"urlcode":"Formulas","name":"Formulas"}]}],"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