Formula to count items in a cell separated by a semicolon
Good afternoon, could someone help me with a formula to count items in a cell separated by a semicolon and put the total in another?
I have a column called: "MRA Actives codes", in which there are different medical codes separated by a semicolon, for example:
I70.0: Atherosclerosis of aorta; I50.9: Heart failure unspecified; D68.69: Other thrombophilia;
The other column is called: "Total MRA Actives codes" and in this case I would like "3" to appear, because there are 3 codes in total.
Thanks in advance.
Best Answers
-
Nick Korna ✭✭✭✭✭
This should do the trick:
=LEN([MRA ACTIVES CODES]@row) - LEN(SUBSTITUTE([MRA ACTIVES CODES]@row, ";", ""))
This calculates the length of the MRA codes cell, then does the same if the semi-colons were removed and subtracts it to get the answer on how many of them there were.
Hope this helps - if you have any issues then just post!
-
Paul Newcome ✭✭✭✭✭✭
If you remove the semi-colons and subtract that character count from the total character count WITH the semi-colons, that will tell you how many entries are in the cell.
=LEN(Column Name]@row) - LEN(SUBSTITUTE([Column name]@row, ";", ""))
thinkspi.com
Answers
-
Kleerfyre ✭✭✭✭✭✭
Are you just wanting a formula to read what comes after the semicolon and count them based on their types?
Jonathan Sanders, CSM
"Change is always scary because it is unknown, but facing the unknown is what makes us stronger."
-
Kleerfyre ✭✭✭✭✭✭
=COUNTIF([MRA Actives codes]:[MRA Actives codes], CONTAINS("Atherosclerosis of aorta", [MRA Actives codes]:[MRA Actives codes]))
Try and see if that works for the single code.
Jonathan Sanders, CSM
"Change is always scary because it is unknown, but facing the unknown is what makes us stronger."
-
Kleerfyre ✭✭✭✭✭✭
So, I just re-read your question, If you are just wanting it to count the number of codes, then just do this:
=COUNTIF([MRA Actives codes]:[MRA Actives codes], <> " ")
That will count all of the cells of that column that are not blank.
Jonathan Sanders, CSM
"Change is always scary because it is unknown, but facing the unknown is what makes us stronger."
-
It is more about counting the codes in the MRA Actives Codes column that are separated by a semicolon, but are not always the same codes. Sorry if I didn't explain myself well and thank you very much for helping me.
Something like in the image that I have attached (I put the numbers manually, but I would like them to be generated automatically)
-
Nick Korna ✭✭✭✭✭
This should do the trick:
=LEN([MRA ACTIVES CODES]@row) - LEN(SUBSTITUTE([MRA ACTIVES CODES]@row, ";", ""))
This calculates the length of the MRA codes cell, then does the same if the semi-colons were removed and subtracts it to get the answer on how many of them there were.
Hope this helps - if you have any issues then just post!
-
Paul Newcome ✭✭✭✭✭✭
If you remove the semi-colons and subtract that character count from the total character count WITH the semi-colons, that will tell you how many entries are in the cell.
=LEN(Column Name]@row) - LEN(SUBSTITUTE([Column name]@row, ";", ""))
thinkspi.com
Help Article Resources
Categories
If your primary column is always going to have the text \"#...\" at the end of the field for the first parent row in each group, you should be able to use the \"#\" as a starting point to reference in a RIGHT function. In this case, the below formula should work as a column formula in the Project_Number column. You will just need to substitute your column name \"Project\\Epic\\Feature\\Sprint Objectives\\Task\" wherever it says Primary Column.<\/p>
=IF(COUNT(ANCESTORS([Primary Column]@row)) = 0, RIGHT([Primary Column]@row, LEN([Primary Column]@row) - FIND(\"#\", [Primary Column]@row)), PARENT([Project_Number]@row))<\/p>
Using the LEN - FIND functions should keep the formula working correctly as you get into multiple-digit project numbers. Keep in mind that this formula will need to be updated if the text \"#...\" is ever omitted\/changed in the primary column or if it is not the rightmost text in the field.<\/p>
Hope this works for you! 😊<\/span><\/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":107045,"type":"question","name":"IF AND\/OR plus a VLOOKUP","excerpt":"I'm having trouble getting a formula correct; I keep getting unparsable or circular reference. I'm wanting to add the name of our rep based on the status of two columns. If the CRM Portfolio is checked AND the Jurisdiction = Federal, I want to insert the name \"Jason\". If the CRM Portfolio is checked and the Jurisdiction is…","snippet":"I'm having trouble getting a formula correct; I keep getting unparsable or circular reference. I'm wanting to add the name of our rep based on the status of two columns. If the…","categoryID":322,"dateInserted":"2023-06-28T18:44:17+00:00","dateUpdated":null,"dateLastComment":"2023-06-29T12:10:45+00:00","insertUserID":118833,"insertUser":{"userID":118833,"name":"Patti Hammonds","url":"https:\/\/community.smartsheet.com\/profile\/Patti%20Hammonds","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!pFFY6XW-qfo!8mdfd1RJ8jo!9etB_NquGxb","dateLastActive":"2023-06-28T18:51:20+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-06-29T12:50:07+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":21,"score":null,"hot":3376020302,"url":"https:\/\/community.smartsheet.com\/discussion\/107045\/if-and-or-plus-a-vlookup","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/107045\/if-and-or-plus-a-vlookup","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":107045,"commentID":383037,"name":"Re: IF AND\/OR plus a VLOOKUP","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/383037#Comment_383037","dateInserted":"2023-06-29T12:10:45+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-06-29T12:50:07+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"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\/431QLFVXWSYV\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-29T10:23:55+00:00","dateAnswered":"2023-06-28T18:51:53+00:00","acceptedAnswers":[{"commentID":382939,"body":" Give this a try:<\/p> =IF([CRM Portfolio]@row = 1, IF(Jurisdiction@row = \"Federal\", \"Jason\", VLOOKUP(State@row, {CL_States Range 2}, 2, false)))<\/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":107038,"type":"question","name":"Modified Date loses detail when referenced","excerpt":"Application: Trying to capture and display a 'sheet last modified' value on a dashboard. Approach: Using a formula in the sheet summary sidebar to find the max value of all timestamps in the 'Modified' column. Formula is as follows and is functioning as expected. =MAX([Modified]:[Modified]) Problem: The displayed value…","snippet":"Application: Trying to capture and display a 'sheet last modified' value on a dashboard. Approach: Using a formula in the sheet summary sidebar to find the max value of all…","categoryID":322,"dateInserted":"2023-06-28T17:43:23+00:00","dateUpdated":null,"dateLastComment":"2023-06-29T12:25:55+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-06-28T21:44:18+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-06-29T12:50:07+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":4,"countViews":31,"score":null,"hot":3376018158,"url":"https:\/\/community.smartsheet.com\/discussion\/107038\/modified-date-loses-detail-when-referenced","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/107038\/modified-date-loses-detail-when-referenced","format":"Rich","lastPost":{"discussionID":107038,"commentID":383050,"name":"Re: Modified Date loses detail when referenced","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/383050#Comment_383050","dateInserted":"2023-06-29T12:25:55+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-06-29T12:50:07+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-28T21:29:15+00:00","dateAnswered":"2023-06-28T18:46:15+00:00","acceptedAnswers":[{"commentID":382932,"body":" Set the Sheet Summary field as text\/number then add +\"\" to the end of the MAX function (plus quote quote) to convert it into a text string.<\/p> =MAX([Modified]:[Modified]) + \"\"<\/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":[]}">