IF statement that can pull data from more than one cell if
We are using Smartsheet as a ticketing system for reporting guest issues. I have set up a form for our team to use where they can select the "primary issue category", and then based on the issue they choose, it gives them another drop down where they can choose a "secondary issue" where they can be more specific about what the issue is.
In the data set, I have used an IF formula in the "secondary issue" column to pull data from the helper columns depending on which "primary issue category" has been selected. This works without issue and I have included the formula below.
=IF([Issue category]@row = "Maintenance issue", [Maintenance issue]@row, IF([Issue category]@row = "Housekeeping issue", [Housekeeping issue]@row, IF([Issue category]@row = "Guest request", [Guest request]@row, IF([Issue category]@row = "Keys and access issue", [Keys and access issues]@row, IF([Issue category]@row = "Lift issue", [Lift issues]@row, IF([Issue category]@row = "Security", [Security issue]@row))))))
But there will be times when a guest complains about multiple things, and instead of splitting these out into multiple rows, I would like to keep it on a single row (one row per guest). I have made it so that multiple options can be selected for "primary issue category", but is there anyway that I can pull data from more than one helper column into the "secondary issue" column?
Best Answer
-
Paul Newcome ✭✭✭✭✭✭
Try this:
=JOIN(COLLECT([Maintenance issue - helper]@row:[Security issue - helper]@row, [Maintenance issue - helper]@row:[Security issue - helper]@row, @cell <> ""), CHAR(10))
Answers
-
Paul Newcome ✭✭✭✭✭✭
-
Hi Paul, yes of course. Here is a screenshot showing the "Primary issue category" column, the "Secondary issue category" column and then all the helper columns (these all relate to one of the drop down options in "Primary issue category"). The formula in "Secondary issue category" is working fine in the first 5 rows where there is only 1 option selected in "Primary issue category". It's the last line where two issues have been selected in the "Primary issue category" where I am having issue pulling the data from the two helper columns. Just to say, it is possible that we will have up to 6 options selected in the "Primary issue category" so we may need to pull from all 6 helper columns, although I think that is rare. I reckon most times if it happens we would need to pull from 2 or 3 at most.
Hopefully the screenshot below works, but let me know if you need anything else.
-
Paul Newcome ✭✭✭✭✭✭
Try this:
=JOIN(COLLECT([Maintenance issue - helper]@row:[Security issue - helper]@row, [Maintenance issue - helper]@row:[Security issue - helper]@row, @cell <> ""), CHAR(10))
-
Nick Korna ✭✭✭✭✭✭
Hi@hannahstayo,
If you set the primary issue category dropdown to allow multiple selections, you can use the logic portion of the form to allow multiple things to be entered at once:
Example:
结合表本身的问题,you can use the JOIN function. You can either have this very simple with just a space as a delimiter (as an example):
=JOIN([Maintenance issue]@row:[Security issue]@row, " ")
or with the addition of a helper cell or summary you can have a line break (using a summary as the helper in this example):
=JOIN([Maintenance issue]@row:[Security issue]@row, SUBSTITUTE(Helper#, "-", " "))
Hope this helps, but if you've any issues/questions then just post!
-
Hi both,
Thanks for your help with this and getting back to me so quickly.@Paul NewcomeAll three solutions worked, and I have made a note for the future as I am sure I will need to do something like this again!
-
Paul Newcome ✭✭✭✭✭✭
@hannahstayoHappy to help.️
@Nick KornaTwo notes:
When using just a basic JOIN function, it will repeat the delimiter for all blank cells. So if you used a comma as a delimiter instead of a space, you could end up with "Cell 1 Value,,,,,,,,,". That's why I personally like to use the JOIN/COLLECT to exclude the blank cells.
You can also use CHAR(10) for the line break. It gets rid of the need for a helper cell as well as the SUBSTITUTE function.
-
Nick Korna ✭✭✭✭✭✭
Thanks@Paul Newcome, I wasn't aware on the line break char so good to learn how to do that!
-
Hi@Paul Newcomeone question on the formula you shared. Is there a way to have these all show in a single line, with a comma splitting them? I am using Zapier to send the data to Slack (as Smartsheets Slack integration isn't good enough for me to use it yet), and because the options are all on a separate line in the cell, it's affecting the format of the Slack message.
=JOIN(COLLECT([Maintenance issue - helper]@row:[Security issue - helper]@row, [Maintenance issue - helper]@row:[Security issue - helper]@row, @cell <> ""), CHAR(10))
-
Paul Newcome ✭✭✭✭✭✭
@hannahstayoYou would adjust the delimiter portion of the JOIN function.
=JOIN(COLLECT([Maintenance issue - helper]@row:[Security issue - helper]@row, [Maintenance issue - helper]@row:[Security issue - helper]@row, @cell <> ""),CHAR(10))
-
@Paul NewcomePerfect thanks! Wasn't 100% which part I had to change, but that's working now
-
Paul Newcome ✭✭✭✭✭✭
Help Article Resources
Categories
Replace [Employee] if your column has a difference name. This will essentially generate a list of distinct entries and then count them.<\/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"}]},{"discussionID":109307,"type":"question","name":"Show approval status based on # of approvals vs. denials","excerpt":"I'm looking for a formula that will show \"Yes\", \"Hold\", or \"No\" based on # of approvals. There are 6 total approvals needed, if all 6 approve, then the Approved column would show \"Yes\". If there is 1 or more denials, then the Approved column would show \"No\". If the total of the columns don't equal to 6, then the Approved…","snippet":"I'm looking for a formula that will show \"Yes\", \"Hold\", or \"No\" based on # of approvals. There are 6 total approvals needed, if all 6 approve, then the Approved column would show…","categoryID":322,"dateInserted":"2023-08-22T21:20:12+00:00","dateUpdated":null,"dateLastComment":"2023-08-22T22:04:40+00:00","insertUserID":96646,"insertUser":{"userID":96646,"name":"@SPark","url":"https:\/\/community.smartsheet.com\/profile\/%40SPark","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!co_Wh_2S-n4!ZAPZGbmgZrw!TRZYwfjvFdi","dateLastActive":"2023-08-22T22:57:22+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭"},"updateUserID":null,"lastUserID":96646,"lastUser":{"userID":96646,"name":"@SPark","url":"https:\/\/community.smartsheet.com\/profile\/%40SPark","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!co_Wh_2S-n4!ZAPZGbmgZrw!TRZYwfjvFdi","dateLastActive":"2023-08-22T22:57:22+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":31,"score":null,"hot":3385482292,"url":"https:\/\/community.smartsheet.com\/discussion\/109307\/show-approval-status-based-on-of-approvals-vs-denials","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109307\/show-approval-status-based-on-of-approvals-vs-denials","format":"Rich","lastPost":{"discussionID":109307,"commentID":392022,"name":"Re: Show approval status based on # of approvals vs. denials","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392022#Comment_392022","dateInserted":"2023-08-22T22:04:40+00:00","insertUserID":96646,"insertUser":{"userID":96646,"name":"@SPark","url":"https:\/\/community.smartsheet.com\/profile\/%40SPark","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!co_Wh_2S-n4!ZAPZGbmgZrw!TRZYwfjvFdi","dateLastActive":"2023-08-22T22:57:22+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\/AJ5OBZXXQRAU\/2820-29-intake-smartsheet-com-2023-08-22-14-16-38.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"(20) Intake - Smartsheet.com 2023-08-22 14-16-38.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-22T22:04:29+00:00","dateAnswered":"2023-08-22T21:36:22+00:00","acceptedAnswers":[{"commentID":392011,"body":"
Something like this: =IF([Approval Count]@row = 6, \"Yes\", IF([Denied Count]@row >= 1, \"No\", \"Hold\"))<\/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":109287,"type":"question","name":"Formula help","excerpt":"=IF([WD Schematic End]@row = \"n\/a\", 0, IF([WD Schematic End]@row > [STR Schematic End]@row, 1, 0)) Above formula meant to trigger a red flag if the WD & STR Schematic End dates do not match. The formula I wrote is pulling back 'invalid' ... I am missing something and cannot figure out what!","snippet":"=IF([WD Schematic End]@row = \"n\/a\", 0, IF([WD Schematic End]@row > [STR Schematic End]@row, 1, 0)) Above formula meant to trigger a red flag if the WD & STR Schematic End dates do…","categoryID":322,"dateInserted":"2023-08-22T17:45:32+00:00","dateUpdated":null,"dateLastComment":"2023-08-22T18:30:00+00:00","insertUserID":157887,"insertUser":{"userID":157887,"name":"holli.nunn","url":"https:\/\/community.smartsheet.com\/profile\/holli.nunn","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-22T18:29:36+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":157887,"lastUser":{"userID":157887,"name":"holli.nunn","url":"https:\/\/community.smartsheet.com\/profile\/holli.nunn","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-22T18:29:36+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":28,"score":null,"hot":3385456532,"url":"https:\/\/community.smartsheet.com\/discussion\/109287\/formula-help","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109287\/formula-help","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109287,"commentID":391947,"name":"Re: Formula help","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/391947#Comment_391947","dateInserted":"2023-08-22T18:30:00+00:00","insertUserID":157887,"insertUser":{"userID":157887,"name":"holli.nunn","url":"https:\/\/community.smartsheet.com\/profile\/holli.nunn","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-22T18:29:36+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\/DLAV2H53BW86\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-22T18:29:34+00:00","dateAnswered":"2023-08-22T18:25:02+00:00","acceptedAnswers":[{"commentID":391943,"body":"
Give this a try:<\/p>
=IF([WD Schematic End]@row = \"n\/a\", 0, IF([WD Schematic End]@row <> [STR Schematic End]@row, 1, 0))<\/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":[]}">