Could someone help me with this formula?

We are asking our managers to use SmartSheet to enter information about their employees (via the add form). Be are requiring them to enter the employee ID which has to be 9 digits, but many times they don't enter all the numbers. I read about helper columns to check whether or not the format is accurate and then send an alert/update request after the fact. I know how to set up the alert/update request, but I need help with the formula in the helper column to check whether the format is correct or not. Could someone help me with this formula?

Or if there is already a way to force a format, that would be much better!

Tags:

Best Answer

  • MichaelTCA
    MichaelTCA ✭✭✭✭✭✭
    Answer ✓

    Hello@Estephania

    You can use a checkbox as your helper column and trigger.

    The function will be verifying the length of the value and the box will be checked if it is too short and too long, or unchecked if it is correct.

    We will use the functions LEN and IF.

    =IF(LEN([EmployeeID]@row)=9,0,1)

    The checkbox is a variable that only recognizes true or false results. 0 means False (the ID is the correct length) and 1 means True (the ID is incorrect).

    You can also use =IF(LEN(EmployeeID]@row<>9,1,0) if it's easier for you to recognize. The results will be exactly the same.

Answers

  • MichaelTCA
    MichaelTCA ✭✭✭✭✭✭
    Answer ✓

    Hello@Estephania

    You can use a checkbox as your helper column and trigger.

    The function will be verifying the length of the value and the box will be checked if it is too short and too long, or unchecked if it is correct.

    We will use the functions LEN and IF.

    =IF(LEN([EmployeeID]@row)=9,0,1)

    The checkbox is a variable that only recognizes true or false results. 0 means False (the ID is the correct length) and 1 means True (the ID is incorrect).

    You can also use =IF(LEN(EmployeeID]@row<>9,1,0) if it's easier for you to recognize. The results will be exactly the same.

  • Hi @MichaelTCA,

    Thank you so much! This was super helpful! I can see myself using these formulas A LOT going forward.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the公式手册模板!
You would use something like this:<\/p>

=INDEX(ANCESTORS([Primary Column]@row), 1)<\/p>"},{"commentID":396977,"body":"

=IFFERROR(<\/strong>INDEX(ANCESTORS([Primary Column]@row), 1), [Primary Column]@row)<\/strong><\/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":110753,"type":"question","name":"If\/Then formula","excerpt":"I need to perform a calculation from 3 columns if criteria in a third column is met. What is the formula? Any help is appreciated!","snippet":"I need to perform a calculation from 3 columns if criteria in a third column is met. What is the formula? Any help is appreciated!","categoryID":322,"dateInserted":"2023-09-25T21:29:24+00:00","dateUpdated":null,"dateLastComment":"2023-09-26T17:35:30+00:00","insertUserID":166870,"insertUser":{"userID":166870,"name":"Kelly Cepicky","title":"Director Operations","url":"https:\/\/community.smartsheet.com\/profile\/Kelly%20Cepicky","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-09-26T17:33:58+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":166870,"lastUser":{"userID":166870,"name":"Kelly Cepicky","title":"Director Operations","url":"https:\/\/community.smartsheet.com\/profile\/Kelly%20Cepicky","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-09-26T17:33:58+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":8,"countViews":39,"score":null,"hot":3391431894,"url":"https:\/\/community.smartsheet.com\/discussion\/110753\/if-then-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/110753\/if-then-formula","format":"Rich","lastPost":{"discussionID":110753,"commentID":397031,"name":"Re: If\/Then formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/397031#Comment_397031","dateInserted":"2023-09-26T17:35:30+00:00","insertUserID":166870,"insertUser":{"userID":166870,"name":"Kelly Cepicky","title":"Director Operations","url":"https:\/\/community.smartsheet.com\/profile\/Kelly%20Cepicky","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-09-26T17:33:58+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-09-26T17:35:04+00:00","dateAnswered":"2023-09-26T16:29:13+00:00","acceptedAnswers":[{"commentID":397001,"body":"

Totally possible, though the formula might not necessarily be thought of as \"quick\"! This is also only taking months into account, so it's only looking at the month number and disregards the day.<\/p>

If 2023 is your baseline:<\/p>

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

Formulas are:<\/p>

2023:<\/p>

=IFERROR(IF(AND(YEAR(Start@row) = 2023, YEAR(Start@row) = YEAR(End@row)), MONTH(End@row) - MONTH(Start@row), IF(AND(YEAR(Start@row) < 2023, YEAR(End@row) = 2023), MONTH(End@row), IF(AND(YEAR(Start@row) < 2023, YEAR(End@row) >= 2023), 12, 0))), \"//m.santa-greenland.com/community/discussion/110624/\")<\/p>

2024:<\/p>

=IFERROR(IF(AND(YEAR(Start@row) = 2024, YEAR(Start@row) = YEAR(End@row)), MONTH(End@row) - MONTH(Start@row), IF(AND(YEAR(Start@row) < 2024, YEAR(End@row) = 2024), MONTH(End@row), IF(AND(YEAR(Start@row) <= 2024, YEAR(End@row) >= 2024), 12, 0))), \"//m.santa-greenland.com/community/discussion/110624/\")<\/p>

2025:<\/p>

=IFERROR(IF(AND(YEAR(Start@row) = 2025, YEAR(Start@row) = YEAR(End@row)), MONTH(End@row) - MONTH(Start@row), IF(AND(YEAR(Start@row) < 2025, YEAR(End@row) = 2025), MONTH(End@row), IF(AND(YEAR(Start@row) < 2025, YEAR(End@row) >= 2025), 12, 0))), \"//m.santa-greenland.com/community/discussion/110624/\")<\/p>

As you can see, if you were going further out then just change the year number to the relevant value.<\/p>

This was a bit hurried, so may not be perfect for your purposes. Otherwise I'd probably recommend doing something with one of the functions similar to NETDAYS for the calculations. Hopefully it points you in the right direction though!<\/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":110746,"type":"question","name":"IF, AND, ISBLANK formula","excerpt":"Here is the scenario: If Cell A is BLANK, the value of Cell B is TEXT, what is the NETDAYS between Cell C and Cell D? =IF(AND(ISBLANK([CellA@row), ([CellB@row = \"All Comments Resolved\")), NETDAYS([CellC]@row, [CellD]@row)) Please help!","snippet":"Here is the scenario: If Cell A is BLANK, the value of Cell B is TEXT, what is the NETDAYS between Cell C and Cell D? =IF(AND(ISBLANK([CellA@row), ([CellB@row = \"All Comments…","categoryID":322,"dateInserted":"2023-09-25T20:25:26+00:00","dateUpdated":null,"dateLastComment":"2023-09-26T15:57:35+00:00","insertUserID":159073,"insertUser":{"userID":159073,"name":"SJTA","url":"https:\/\/community.smartsheet.com\/profile\/SJTA","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-09-26T16:21:22+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":151203,"lastUser":{"userID":151203,"name":"Nick Korna","url":"https:\/\/community.smartsheet.com\/profile\/Nick%20Korna","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-09-26T16:17:22+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":7,"countViews":45,"score":null,"hot":3391421581,"url":"https:\/\/community.smartsheet.com\/discussion\/110746\/if-and-isblank-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/110746\/if-and-isblank-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":110746,"commentID":396990,"name":"Re: IF, AND, ISBLANK formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/396990#Comment_396990","dateInserted":"2023-09-26T15:57:35+00:00","insertUserID":151203,"insertUser":{"userID":151203,"name":"Nick Korna","url":"https:\/\/community.smartsheet.com\/profile\/Nick%20Korna","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-09-26T16:17: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,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-09-26T13:31:22+00:00","dateAnswered":"2023-09-26T10:37:52+00:00","acceptedAnswers":[{"commentID":396905,"body":"

Hi @SJTA<\/a>,<\/p>

If you don't mind what the text value in CellB is:<\/p>

=IF(AND(CellA@row = \"//m.santa-greenland.com/community/discussion/110624/\", ISTEXT(CellB@row)), NETDAYS(CellC@row, CellD@row))<\/p>

If you want CellB to be a particular value:<\/p>

=IF(AND(CellA@row = \"//m.santa-greenland.com/community/discussion/110624/\", CellB@row = \"Your text here\"), NETDAYS(CellC@row, CellD@row))<\/p>

Either of these should work - if you're getting an error, what is it?<\/p>"},{"commentID":396953,"body":"

Your formula will have been given errors due to some missing square brackets on the column references. This should work if you wanted ISBLANK instead:<\/p>

=IF(AND(ISBLANK([CellA]@row), [CellB]@row = \"All Comments Resolved\"), NETDAYS([CellC]@row, [CellD]@row))<\/p>

The missing brackets were on the ends of CellA & CellB, which stopped your formula from functioning properly.<\/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