Automatic ticket numbering by location
Hello. I worked with someone on a previous discussion, but for some reason cannot locate it now. I have one data base file with the work orders from many different community locations. I wanted a solution for the Work Order Number to be a combination of the community abbreviation, the year, and then the number of work order for that year. This worked great until 2020 rolled around and I can see now that everything works except for the last part; it did not restart the numbering for this year. Because of this, it changed the year within the work order, but it simply continued on the numbering from 2019.
I have provided the formula below. Within it, the "Community Code" is the abbreviation and the "Request Date" is the date a request was submitted. I've also included a picture in case my explanation of the issue doesn't suffice.
=[Community Code]@row + "-" + YEAR([Request Date]@row) + "-" + RIGHT(10000 + COUNTIF([Community Code]$1:[Community Code]1, [Community Code]@row), 4)
Any help with this is greatly appreciated.
Thanks.
Best Answer
-
Paul Newcome ✭✭✭✭✭✭My apologies. Missed a closing parenthesis...
=[Community Code]@row + "-" + YEAR([Request Date]@row) + "-" + RIGHT(10000 + COUNTIFS([Community Code]$1:[Community Code]@row, [Community Code]@row, [Request Date]$1:[Request Date]@row, YEAR(@cell) = YEAR([Request Date]@row)), 4)
That was also the issue with the first formula I provided.
Answers
-
Paul Newcome ✭✭✭✭✭✭Where are new rows added? Are they always added at the bottom of the sheet?
-
M. David ✭✭✭✭✭Yes. They are always added at the bottom.
-
Paul Newcome ✭✭✭✭✭✭Ok. Then we should be able to take your original formula and add a condition to the COUNTIFS that will include the year.
=[Community Code]@row + "-" + YEAR([Request Date]@row) + "-" + RIGHT(10000 + COUNTIFS([Community Code]$1:[Community Code]1, [Community Code]@row, [Request Date]$1:[Request Date]1, YEAR(@cell) = YEAR([Request Date]@row), 4)
-
M. David ✭✭✭✭✭Hey. I tried that out and it is returning an error message. It is an "Incorrect Argument Set" error. Any ideas what could cause this? I tried to follow the path on the new range and criteria you added, but didn't see what is causing the error. Thanks.
-
Paul Newcome ✭✭✭✭✭✭Did you change COUNTIF to COUNTIFS (with the S on the end)?
-
M. David ✭✭✭✭✭Yes. I typed it in. I did just notice an extra ")" I left in. When I took that out, no longer received an error message, but the formatting was incorrect. It dropped the 4 digits at the end and made it simply a one digit code. I copied this formula from row one into the area where I knew the years crossed over from 2019 to 2020 and updated the row references. After this, I dragged it down and have a very interesting result. It randomly shows the first number as a "7". It then restarts the numbering. See the picture below. If possible, I'd like to keep the four digits, so ticket number one would be CODE-2020-0001.
Thanks for you help with this. I do appreciate the help.
-
Paul Newcome ✭✭✭✭✭✭It should not have dropped the leading zeros. Those leading zeros actually come from the bold part below
RIGHT(10000 +COUNTIFS(...................), 4)
Put this in row 1 and dragfill down, then take a look at an area that shows a year change.
=[Community Code]@row + "-" + YEAR([Request Date]@row) + "-" + RIGHT(10000 + COUNTIFS([Community Code]$1:[Community Code]@row, [Community Code]@row, [Request Date]$1:[Request Date]@row, YEAR(@cell) = YEAR([Request Date]@row), 4)
-
M. David ✭✭✭✭✭I did this and it shows the Incorrect Argument Set error again.
-
Paul Newcome ✭✭✭✭✭✭My apologies. Missed a closing parenthesis...
=[Community Code]@row + "-" + YEAR([Request Date]@row) + "-" + RIGHT(10000 + COUNTIFS([Community Code]$1:[Community Code]@row, [Community Code]@row, [Request Date]$1:[Request Date]@row, YEAR(@cell) = YEAR([Request Date]@row)), 4)
That was also the issue with the first formula I provided.
-
M. David ✭✭✭✭✭Eureka! That solved the problem. I always start by looking at parenthesis when there's a problem but I missed it as well. Thank you for all of your help with this. I really appreciate it.
-
Paul Newcome ✭✭✭✭✭✭
Help Article Resources
Categories
Try this:<\/p>
=IF(ISDATE([Event Date]@row), IF(AND([Event Date]@row > TODAY(), [Event Date]@row <= TODAY(30)), \"Less than 30 days from today\", \"More than 30 days from today\"), \"//www.santa-greenland.com/community/discussion/comment/\")<\/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":108267,"type":"question","name":"Combining IF Formula for Blank\/ Not Blank Cells","excerpt":"I want to create a formula that provides the below statuses: -Complete: Based on \"Collected Date\" not null -Incomplete: Based on \"Collected Date\" null and \"Antcipated Collected Date\" null -Pending: Based on \"Anticipated Collcted Date\" not null and \"Collected Date\" null Below is what I have, but it's unparseable:…","snippet":"I want to create a formula that provides the below statuses: -Complete: Based on \"Collected Date\" not null -Incomplete: Based on \"Collected Date\" null and \"Antcipated Collected…","categoryID":322,"dateInserted":"2023-07-28T17:23:40+00:00","dateUpdated":null,"dateLastComment":"2023-07-28T18:28:47+00:00","insertUserID":164288,"insertUser":{"userID":164288,"name":"brownrobe","url":"https:\/\/community.smartsheet.com\/profile\/brownrobe","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-28T18:42:06+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":164288,"lastUser":{"userID":164288,"name":"brownrobe","url":"https:\/\/community.smartsheet.com\/profile\/brownrobe","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-28T18:42:06+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":39,"score":null,"hot":3381135147,"url":"https:\/\/community.smartsheet.com\/discussion\/108267\/combining-if-formula-for-blank-not-blank-cells","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108267\/combining-if-formula-for-blank-not-blank-cells","format":"Rich","lastPost":{"discussionID":108267,"commentID":387885,"name":"Re: Combining IF Formula for Blank\/ Not Blank Cells","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/387885#Comment_387885","dateInserted":"2023-07-28T18:28:47+00:00","insertUserID":164288,"insertUser":{"userID":164288,"name":"brownrobe","url":"https:\/\/community.smartsheet.com\/profile\/brownrobe","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-28T18:42:06+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-07-28T18:30:11+00:00","dateAnswered":"2023-07-28T18:22:11+00:00","acceptedAnswers":[{"commentID":387882,"body":"


