How to ignore blank cells when stringing cell values together

Hi everyone!

Hoping someone can help me out. I have created a Smartsheet form that someone can fill out to create a custom URL. On the backend of the Smartsheet, I have a formula set up to string all the values together and add delimiters into a url string. It works great, with one exception.

All of the form fields are mandatory except for one. I need to add something into the function to remove a blank value from the final string if the cell for that value is blank.

My current set up is:

=([Website URL]11 + "?utm_medium=" + [Final Medium]11 + "&utm_source=" + [Final Source]11 + "&utm_campaign=" + Campaign11 + "&utm_term=" + Term11 + "&utm_content=" + Content11)

The field in question is "Term". So if the Term column has a blank value, I need it remove "&utm_term=" + Term11 from the final string.

Can someone help me out? Thanks!

Best Answer

  • Toufong Vang
    Toufong Vang ✭✭✭✭✭
    Answer ✓

    Hi, Scott.

    Give this a try...

    =([Website URL]11 + "?utm_medium=" + [Final Medium]11 + "&utm_source=" + [Final Source]11 + "&utm_campaign=" + Campaign11 + (IF(ISBLANK(Term11),"", "&utm_term=" + Term11)) + "&utm_content=" + Content11)

    In your formula you had"&utm_term=" + Term11in betweenCampaign11 +and+ "&utm_content="

    Since you already have your logic defined,leave blank if Term11 is blank, form it between(...)and then insert that into your formula.

    If term is blankISBLANK(Term11)then use empty""else use"&utm_term=" + Term11

    ( IF( ISBLANK(Term11), "", "&utm_term=" + Term11) )

Answers

  • Toufong Vang
    Toufong Vang ✭✭✭✭✭
    Answer ✓

    Hi, Scott.

    Give this a try...

    =([Website URL]11 + "?utm_medium=" + [Final Medium]11 + "&utm_source=" + [Final Source]11 + "&utm_campaign=" + Campaign11 + (IF(ISBLANK(Term11),"", "&utm_term=" + Term11)) + "&utm_content=" + Content11)

    In your formula you had"&utm_term=" + Term11in betweenCampaign11 +and+ "&utm_content="

    Since you already have your logic defined,leave blank if Term11 is blank, form it between(...)and then insert that into your formula.

    If term is blankISBLANK(Term11)then use empty""else use"&utm_term=" + Term11

    ( IF( ISBLANK(Term11), "", "&utm_term=" + Term11) )

  • Hi, Scott.<\/p>

    Give this a try...<\/p>

    =([Website URL]11 + "?utm_medium=" + [Final Medium]11 + "&utm_source=" + [Final Source]11 + "&utm_campaign=" + Campaign11 + (IF(ISBLANK(Term11),"", "&utm_term=" + Term11)) + "&utm_content=" + Content11)<\/code><\/p>

    In your formula you had "&utm_term=" + Term11<\/code> in between Campaign11 +<\/code> and + "&utm_content="<\/code><\/p>

    Since you already have your logic defined, leave blank if Term11 is blank<\/em>, form it between (...)<\/strong> and then insert that into your formula.<\/p>

    If term is blankISBLANK(Term11)<\/code> then use empty ""<\/code> else use "&utm_term=" + Term11<\/code> <\/p>

    ( IF( ISBLANK(Term11), "", "&utm_term=" + Term11) )<\/code><\/p>","bodyRaw":"[{\"insert\":\"Hi, Scott.\\nGive this a try...\\n\"},{\"attributes\":{\"code\":true},\"insert\":\"=([Website URL]11 + \\\"?utm_medium=\\\" + [Final Medium]11 + \\\"&utm_source=\\\" + [Final Source]11 + \\\"&utm_campaign=\\\" + Campaign11 + (IF(ISBLANK(Term11),\\\"\\\", \\\"&utm_term=\\\" + Term11)) + \\\"&utm_content=\\\" + Content11)\"},{\"insert\":\"\\nIn your formula you had \"},{\"attributes\":{\"code\":true},\"insert\":\"\\\"&utm_term=\\\" + Term11\"},{\"insert\":\" in between \"},{\"attributes\":{\"code\":true},\"insert\":\" Campaign11 +\"},{\"insert\":\" and \"},{\"attributes\":{\"code\":true},\"insert\":\"+ \\\"&utm_content=\\\"//www.santa-greenland.com/community/discussion/comment/\"},{\"insert\":\"\\nSince you already have your logic defined,\"},{\"attributes\":{\"italic\":true},\"insert\":\" leave blank if Term11 is blank\"},{\"insert\":\", form it between \"},{\"attributes\":{\"bold\":true},\"insert\":\"(...)\"},{\"insert\":\" and then insert that into your formula.\\nIf term is blank\"},{\"attributes\":{\"code\":true},\"insert\":\"ISBLANK(Term11)\"},{\"insert\":\" then use empty \"},{\"attributes\":{\"code\":true},\"insert\":\"\\\"\\\"//www.santa-greenland.com/community/discussion/comment/\"},{\"insert\":\" else use \"},{\"attributes\":{\"code\":true},\"insert\":\"\\\"&utm_term=\\\" + Term11\"},{\"insert\":\" \\n\"},{\"attributes\":{\"code\":true},\"insert\":\"( IF( ISBLANK(Term11), \\\"\\\", \\\"&utm_term=\\\" + Term11) )\"},{\"insert\":\"\\n\\n\"}]","format":"rich","dateInserted":"2021-06-09T22:35:27+00:00","insertUser":{"userID":136737,"name":"Toufong Vang","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Toufong%20Vang","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/avatarstock\/n65S9PRP4PA0M.png","dateLastActive":"2023-06-28T16:10:01+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"displayOptions":{"showUserLabel":false,"showCompactUserInfo":true,"showDiscussionLink":false,"showPostLink":false,"showCategoryLink":false,"renderFullContent":false,"expandByDefault":false},"url":"https:\/\/community.smartsheet.com\/discussion\/comment\/294433#Comment_294433","embedType":"quote"}"> https://community.smartsheet.com/discussion/comment/294433#Comment_294433

    Hi@TFC. This worked perfectly! Thanks so much for such a quick response!

  • Andrée Starå
    Andrée Starå ✭✭✭✭✭✭

    Hi@Scott Burry

    I hope you're well and safe!

    增加交通的优秀建议/答案.

    I'd recommend changing the row numbers to @row instead, so you don't have to think about the row numbers + you might be able to make it a so-called column formula.

    Something like this.

    =([Website URL]@row + "?utm_medium=" + [Final Medium]@row + "&utm_source=" + [Final Source]@row + "&utm_campaign=" +[email protected]+ (IF(ISBLANK([email protected]),"", "&utm_term=" +[email protected])) + "&utm_content=" +[email protected])

    I hope that helps!

    Be safe and have a fantastic week!

    Best,

    Andrée Starå| Workflow Consultant / CEO @WORK BOLD

    Did my post(s) help or answer your question or solve your problem? Please support the Community bymarking it Insightful/Vote Up or/and as the accepted answer. It will make it easier for others to find a solution or help to answer!

    SMARTSHEET EXPERT CONSULTANT & PARTNER

    Andrée Starå| Workflow Consultant / CEO @WORK BOLD

    W:www.workbold.com| E:[email protected]| P: +46 (0) - 72 - 510 99 35

    Feel free to contact me about help with Smartsheet, integrations, general workflow advice, or something else entirely.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out theFormula Handbook template!
DATE(2023, 6, 1), [Date Closed]:[Date Closed], DATE(2023, 6, 1), [Date…","categoryID":322,"dateInserted":"2023-08-01T14:29:49+00:00","dateUpdated":null,"dateLastComment":"2023-08-01T15:54:04+00:00","insertUserID":155497,"insertUser":{"userID":155497,"name":"JSpears","url":"https:\/\/community.smartsheet.com\/profile\/JSpears","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!BgDcwSo-92c!7zlc-6IqQLs!HEmr4KUqqxd","dateLastActive":"2023-08-01T15:53:37+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭"},"updateUserID":null,"lastUserID":155497,"lastUser":{"userID":155497,"name":"JSpears","url":"https:\/\/community.smartsheet.com\/profile\/JSpears","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!BgDcwSo-92c!7zlc-6IqQLs!HEmr4KUqqxd","dateLastActive":"2023-08-01T15:53:37+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":18,"score":null,"hot":3381806633,"url":"https:\/\/community.smartsheet.com\/discussion\/108345\/averageif-with-multiple-criterion","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108345\/averageif-with-multiple-criterion","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":108345,"commentID":388234,"name":"Re: AverageIf with multiple criterion","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/388234#Comment_388234","dateInserted":"2023-08-01T15:54:04+00:00","insertUserID":155497,"insertUser":{"userID":155497,"name":"JSpears","url":"https:\/\/community.smartsheet.com\/profile\/JSpears","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!BgDcwSo-92c!7zlc-6IqQLs!HEmr4KUqqxd","dateLastActive":"2023-08-01T15:53:37+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\/EFAIAZ6PP2LD\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-01T15:53:35+00:00","dateAnswered":"2023-08-01T14:41:23+00:00","acceptedAnswers":[{"commentID":388203,"body":"

Try this:<\/p>

=AVG(COLLECT([Resolution Time (Days)]:[Resolution Time (Days)], [Date Closed]:[Date Closed], AND(@cell>DATE(2023, 6, 1), @cell<DATE(2023, 6, 30))))<\/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":108339,"type":"question","name":"Help on IF formula... validating two columns.","excerpt":"Hi, hope everyone is doing well? hoping someone could please help me with this formula, at the moment I am using the below formula to check the % from Score column and give the outcome result in the Result column and this is working fine, just wondering, if there a way I can include ‘Auto Fail’ in the above formula so if…","snippet":"Hi, hope everyone is doing well? hoping someone could please help me with this formula, at the moment I am using the below formula to check the % from Score column and give the…","categoryID":322,"dateInserted":"2023-08-01T11:55:34+00:00","dateUpdated":null,"dateLastComment":"2023-08-01T13:58:19+00:00","insertUserID":159253,"insertUser":{"userID":159253,"name":"ovelzone","url":"https:\/\/community.smartsheet.com\/profile\/ovelzone","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-01T16:27:58+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"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-08-01T15:39:04+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":4,"countViews":23,"score":null,"hot":3381791633,"url":"https:\/\/community.smartsheet.com\/discussion\/108339\/help-on-if-formula-validating-two-columns","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108339\/help-on-if-formula-validating-two-columns","format":"Rich","lastPost":{"discussionID":108339,"commentID":388190,"name":"Re: Help on IF formula... validating two columns.","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/388190#Comment_388190","dateInserted":"2023-08-01T13:58:19+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-08-01T15:39: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\/C0TNHS5393OE\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-01T13:41:25+00:00","dateAnswered":"2023-08-01T12:08:16+00:00","acceptedAnswers":[{"commentID":388167,"body":"

Try this one:<\/p>

=IF([Autofail]@row = \"Y\", \"Auto Fail\", IF([Score]@row < 0.5, \"Fail\", IF(AND([Score]@row > 0.5, [Score]@row < 0.65), \"Pass\", IF(AND([Score]@row > 0.64, [Score]@row < 0.75), \"Credit\", IF(AND([Score]@row > 0.74, Score]@row < 0.85), \"Distinction\", IF(AND([Score]@row > 0.84, [Score]@row <= 1), \"High Distinction\"))))))<\/p>"},{"commentID":388172,"body":"

This should work for you:<\/p>

=IF(Autofail@row = \"Y\", \"Auto Fail\", IF(Score@row< 0.5, \"Fail\", IF(Score@row< 0.65, \"Pass\", IF(Score@row< 0.75, \"Credit\", IF(Score@row<0.85, \"Distinction\", \"High Distinction\")))))<\/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":108324,"type":"question","name":"Help with Conditional Formatting","excerpt":"I have to create a report that has conditional formatting onto it. I am not really sure how to work Smartsheet's conditional formatting stuff. The example I was given to create was: \"Can color be added based on calendar logic (0-30 days since xxx, for example)\" There is an active sheet that we would use to put the…","snippet":"I have to create a report that has conditional formatting onto it. I am not really sure how to work Smartsheet's conditional formatting stuff. The example I was given to create…","categoryID":322,"dateInserted":"2023-07-31T20:42:59+00:00","dateUpdated":null,"dateLastComment":"2023-08-01T15:15:48+00:00","insertUserID":162512,"insertUser":{"userID":162512,"name":"Hannahsamd","title":"Hannah","url":"https:\/\/community.smartsheet.com\/profile\/Hannahsamd","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-01T15:16:52+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"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-08-01T15:39:04+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":4,"countViews":34,"score":null,"hot":3381741527,"url":"https:\/\/community.smartsheet.com\/discussion\/108324\/help-with-conditional-formatting","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108324\/help-with-conditional-formatting","format":"Rich","lastPost":{"discussionID":108324,"commentID":388218,"name":"Re: Help with Conditional Formatting","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/388218#Comment_388218","dateInserted":"2023-08-01T15:15:48+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-08-01T15:39: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\/Z4RH1R79HNAW\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-01T15:17:55+00:00","dateAnswered":"2023-08-01T06:13:07+00:00","acceptedAnswers":[{"commentID":388141,"body":"

Hi <\/strong>Hannahsamd,<\/strong><\/a><\/p>

I have applied conditional formatting logic by referencing your requirement and you can use the attached image to create the same conditional formatting in Smartsheet.<\/p>

If you are an admin or owner of the sheet, you can apply conditional formatting<\/p>

\n
\n \n \"image.png\"<\/img><\/a>\n <\/div>\n<\/div>\n

By clicking this symbol of conditional formatting, then clicking in the Add New Rule you can give the condition then the format you want, and the specific column or the entire row as required, and then apply it.<\/p>

<\/p>

You can go through the below article of Conditional formatting too.<\/p>

\n \n https:\/\/help.smartsheet.com\/learning-track\/level-1-get-started\/conditional-formatting\n <\/a>\n<\/div>


<\/p>

\n
\n \n \"MicrosoftTeams-image<\/img><\/a>\n <\/div>\n<\/div>\n

Hope it will work for you.<\/p>"},{"commentID":388218,"body":"

Comparing two columns to each other like this is going to require a helper column with a formula to output some kind of indicator for your conditional formatting such as<\/p>

=IF([Date Column A]@row - [Date Column B]@row<= 13, \"R\", IF([Date Column A]@row - [Date Column B]@row<= 20, \"Y\", \"G\"))<\/p>


<\/p>

Then create your conditional formatting based on the output of the 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