Formula (IF Statement?) that checks if row numbered sequentially?
Can I write a formula that could check if rows belonging to same project number have been numbered sequentially? My sheet tracks several projects and each project could have several entries on one sheet and these must be numbered so we know how many submissions were made per project.
I wrote one to check for duplicates with a check column and then used conditional formatting to highlight duplicates.
However now, I need to check that rows being submitted into my sheet have been numbered appropriately, with no skipped numbers and that they are in fact being numbered sequentially. The person submitting will have to indicate if this is their 1st submission, 2nd, 3rd etc for a particular project in a specific dedicated column. So I assumed some sort f If statement that would check this column if Project column is the same, but then get lost on how to write the criterion.
I assumed another check type formula could do the trick but I cannot seem to figure it out. Is this possible?
Best Answers
-
Paul Newcome ✭✭✭✭✭✭
@Susan VieiraHere is my formula rewritten with your column names from your latest screenshot:
=IF([Amendment #]@row <> MAX(COLLECT([Amendment #]$1:[Amendment #]1, [Project #]$1:[Project #]1, [Project #]@row)) + 1, 1)
Edited to correct a column name I had missed when updating.
-
Paul Newcome ✭✭✭✭✭✭
Correct. That is why I mentioned to start the formula in row 2. SO that it would look at the current row but only compare to the previous rows. I am glad it's working for you now.️
Answers
-
L_123 ✭✭✭✭✭✭
It sounds like you need a helper column with a drop down.
=if(projnum2 = projnum1+1,1,0)
You can also automatically create the project numbers with an automatic column so it will assign the numbers on creation of a new row
-
Susan Vieira ✭✭✭✭✭
It's a bit more complicated than your example as I need to compare 2 columns and/or cells.
We cannot automatically number them as the sheet will have several projects with their own submission numbers. It is possible to have several submission 1's depending on how many projects get entered. Project X will have some submissions and those submissions will be numbered and must be sequential and then all submission numbers for Project Y need to be sequential, etc etc.
So I need it to find all rows with Project X and then cross check that the numbers in Submission # column are sequential. Am I making any sense?
So how can I adapt the above formula that checks Submission numbers for a specific project only are sequential? It involves 2 columns Project Number and Submission number.
Thanks again!
-
Paul Newcome ✭✭✭✭✭✭
Couldn't you automate the submission numbers by starting in row 2 and using something along the lines of...
=MAX(COLLECT([Submission #]$1:[Submission #]1, [Project Column]$1:[Project Column]1, [Project Column]@row)) + 1
Basically you pull all of the Submission Numbers from above the current submission where the Project matches, grab the highest value, then add 1 to it.
-
如果你行只是数字,您可以使用此佛rmula:
=IF([Primary Column]@row = [Primary Column]1 + 1, 1, 0)
This is with a blank row above the 1. If you don't want that blank row, you will need to start your formula in the #2 row as it is referencing the row above it.
If your rows contain the words "1st", "2nd", "3rd" etc, this formula won't work. However, you can use a helper column that will convert the number to the words. You can then hide your column with #'s. Column3 in my screenshot contains the same formula looking at Column2 and it doesn't give an error, but doesn't check the box as it can't differentiate the number sequence, but it does work for the Primary Column...
If you do need to have them as words instead of numbers, use this formula to combine them.....
Let me know if you have any questions.
-
Susan Vieira ✭✭✭✭✭
@Paul Newcome, I wish I could but I cannot. The submission numbers are independent and unrelated to Smart Sheet so I cannot have it automatically generated. Thanks so much for your help though!
-
Paul Newcome ✭✭✭✭✭✭
Ok. In that case at least we now have a formula that tells us what the submission number SHOULD be. From there all we would have to do is drop it in an IF statement to say that if the submission number does not equal the output of the above, then flag the row.
=IF([Submission #]@row <> [what it should formula], 1)
=IF([Submission #]@row <> MAX(COLLECT([Submission #]$1:[Submission #]1, [Project Column]$1:[Project Column]1, [Project Column]@row)) + 1, 1)
-
Susan Vieira ✭✭✭✭✭
@Leslie Merlino, I do not need to have it written 1st or 2nd, 1 and 2 is fine.
I like your formula but it is not just about the numbers in primary column, it will depend on the project it is linked to.
See photo for example. I want to make sure that The next Project B Amendment # is 4. And if they submit 5, I want something (conditional formatting I assume) to flag that amendment 4 is missing for Project B. Same for A and that the next C will be 2 and not 4.
-
Paul Newcome ✭✭✭✭✭✭
@Susan VieiraHere is my formula rewritten with your column names from your latest screenshot:
=IF([Amendment #]@row <> MAX(COLLECT([Amendment #]$1:[Amendment #]1, [Project #]$1:[Project #]1, [Project #]@row)) + 1, 1)
Edited to correct a column name I had missed when updating.
-
Susan Vieira ✭✭✭✭✭
@Paul NewcomeThank you. I feel I am so close but I cannot get it to work/figure it out.
Here is what it looks like:
It is checking everything, even though project C and A are out of sequence. I want Row 8 & 9 to be flagged for being out of sequence. Either with a check or no check, I don't care which.
-
Susan Vieira ✭✭✭✭✭
I believe I got it to work!!! See pic with final formula. I needed it to evaluate the range of amendments except for the new row of cells.
Thank you!
-
Paul Newcome ✭✭✭✭✭✭
Correct. That is why I mentioned to start the formula in row 2. SO that it would look at the current row but only compare to the previous rows. I am glad it's working for you now.️
-
Susan Vieira ✭✭✭✭✭
ooops, I missed that comment, it would have have saved me some frustration. Thanks again, so helpful!
-
Paul Newcome ✭✭✭✭✭✭
Help Article Resources
Categories
Check out theFormula Handbook template!
=COUNTIFS([Item Number]:[Item Number], OR(@cell = \"C001\", @cell = \"COO2\", @cell = \"COO3\", @cell = \"COO4\"), [Status]:[Status], OR(@cell = \"Green\", @cell = \"Yellow\", @cell = \"Red\"))<\/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":109490,"type":"question","name":"HAS exact match within multiselect - Numbered Values","excerpt":"Scenario: Trying to identify a match if a value shows up in a multiselect from another sheet. Approach: I'm able to get 95% of this done through an index(collect(contains))) formula, but having some false positives show up wherever a partial match is found. I later found some suggestions that (has) would be more…","snippet":"Scenario: Trying to identify a match if a value shows up in a multiselect from another sheet. Approach: I'm able to get 95% of this done through an index(collect(contains)))…","categoryID":322,"dateInserted":"2023-08-25T19:26:32+00:00","dateUpdated":null,"dateLastComment":"2023-08-26T00:49:48+00:00","insertUserID":154049,"insertUser":{"userID":154049,"name":"Rob W.","url":"https:\/\/community.smartsheet.com\/profile\/Rob%20W.","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:49:37+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":154049,"lastUser":{"userID":154049,"name":"Rob W.","url":"https:\/\/community.smartsheet.com\/profile\/Rob%20W.","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:49: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":3386003780,"url":"https:\/\/community.smartsheet.com\/discussion\/109490\/has-exact-match-within-multiselect-numbered-values","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109490\/has-exact-match-within-multiselect-numbered-values","format":"Rich","lastPost":{"discussionID":109490,"commentID":392694,"name":"Re: HAS exact match within multiselect - Numbered Values","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392694#Comment_392694","dateInserted":"2023-08-26T00:49:48+00:00","insertUserID":154049,"insertUser":{"userID":154049,"name":"Rob W.","url":"https:\/\/community.smartsheet.com\/profile\/Rob%20W.","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:49: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\/KJPRLKL2FW16\/capture-png.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"Capture.PNG"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-26T00:49:35+00:00","dateAnswered":"2023-08-25T23:58:23+00:00","acceptedAnswers":[{"commentID":392688,"body":"
Hi, <\/p>
Instead of applying the formula to \"Multiselect Text String\" row, did you tried with \"Multiselect Values\" row?<\/p>
=IF(HAS([Multiselect Values]@row, [Component ID]@row), \"MATCH\", \"NO MATCH\")<\/p>
Thank you,<\/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":109474,"type":"question","name":"Help with date calculation formula","excerpt":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the resolution date is blank I want it to use the current date in the calculation to see how long this issue has gone unresolved. Any help is much…","snippet":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the…","categoryID":322,"dateInserted":"2023-08-25T16:29:39+00:00","dateUpdated":"2023-08-25T16:29:59+00:00","dateLastComment":"2023-08-25T23:01:30+00:00","insertUserID":165688,"insertUser":{"userID":165688,"name":"Nwest","title":"Systems Analyst","url":"https:\/\/community.smartsheet.com\/profile\/Nwest","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ukHVZ18ImX4!BcjWAe8S9SY!l7iQo_PZHOx","dateLastActive":"2023-08-25T17:22:30+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":165688,"lastUserID":8888,"lastUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":23,"score":null,"hot":3385987269,"url":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109474,"commentID":392687,"name":"Re: Help with date calculation formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392687#Comment_392687","dateInserted":"2023-08-25T23:01:30+00:00","insertUserID":8888,"insertUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+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-25T17:04:22+00:00","dateAnswered":"2023-08-25T16:36:59+00:00","acceptedAnswers":[{"commentID":392622,"body":"