Hierarchy Formula

FrankOrtz
FrankOrtz
edited 12/09/19 inSmartsheet Basics

Hello!

I've been trying to count how many milestones called "Testing" with %Complete = 100% are per project. Each milestone is a child of a parent called "Milestone" and this is at the same time a child of the project name. At the end, each project is a child of a big project name. (I've attached an example of the structure).

I have read others comments and documentation of the hierarchical formulas, however, it's not clear to me how to develop it correctly.

If someone can help me to elaborate it, I'll appreciate it a lot. I'm learning in the process.

Thank you!

projects stucture.JPG

Comments

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

    Hi,

    Try something like this.

    I've used CHILDREN in my example, but you could change the ranges if you need.

    =COUNTIFS(CHILDREN([% Complete]1); "1"; CHILDREN([Big Project Name]1); FIND("testing"; LOWER(@cell))> 0)

    The same version but with the below changes for your and others convenience.

    =COUNTIFS(CHILDREN([% Complete]1), "1", CHILDREN([Big Project Name]1), FIND("testing", LOWER(@cell))> 0)

    Depending on your country you’ll need to exchange the comma to a period and the semi-colon to a comma.

    Did it work?

    Have a fantastic weekend!

    Best,

    Andrée Starå

    Workflow Consultant @ Get Done Consulting

    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.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Andree:

    A few observations if I may...

    .

    I feel like using the CHILDREN function may actually keep this from working as it would only be looking at the child rows of the specified cell. You formula above would only be looking at the rows containing the project numbers.

    From what I gather from the screenshot Frank provided, only the lowest level of hierarchy is going to contain the word "Testing", so couldn't we reference the entire column instead of having to look at a specific hierarchy level?

    .

    I love the LOWER addition. I have been building that into my FIND functions more and more lately. It just makes life easier.

    .

    And finally... There you go with those quotes again. Lol!cheekywink

    Using "1" as the criteria will mean that it is looking for that very specific text. Using 1 means it will look for that number.

    .

    Taking the above into account and using your formula as a base, I would actually end up making the suggestion of...

    =COUNTIFS([% Complete]:[% Complete], 1, [milestones names]:[milestones names], FIND("testing", LOWER(@cell))> 0)

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

    Paul,

    You may not but you already did so!laugh

    I don't agree regarding the children because Frank wanted to have them per project and it seems like it should work according to his structure.

    Frank decideswink

    The quotes don't matter in this scenario because it will work anyway. I think I added them becauseindecisionwinklaugh

    Best,

    Andrée

    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.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Andree,

    I missed the "per project" when I first read the post. I was going for an overall tally. That's my mistake.

    所以你会把你提供的公式ed on the rows that have "Milestones project #" and replace the cell reference to "[milestones names]@row"?

    As for the quotes... I can never figure out when they can and can't be used. I've always just used the general rule of thumb that quotes means text and no quotes means number. I didn't realize it would work in a % Complete column like that. Apparently you can even manually enter "100%" without having it formatted as a percentage, and it will still register as "1".

    Thanks for putting me in my place.blushwinklaugh

    .

    .

    Frank,

    Nevermind our back and forth. Hopefully you're able to sift through all of the mess and find a working solution. Let us know if you can't and we will see if Andree can come up with something else. Hahaha. Welcome to the Community.winkyes

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

    Paul,

    No worries!

    Best,

    Andrée

    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.

  • Hello Gentlemen!

    Sorry for my late answer.

    Thank you for your help! It was very helpful. At the end, I solved what I wanted with two different formulas. One formula counts if a particular milestone has achieved 100%, and the other formula is when the milestone has been started (>0%) but it's not completed yet.

    Formula 1= IF(COUNTIFS(CHILDREN([% Complete]1), 1, CHILDREN([Interface Name]1), OR(FIND("Coding Program",@cell)> 0, FIND("Modify",@cell)> 0)) > 0, 1)

    Formula 2= IF(OR((COUNTIFS(CHILDREN([% Complete]1), <1, CHILDREN([Interface Name]1), OR(FIND("Coding Program",@cell)> 0, FIND("Modify",@cell)> 0, FIND("Development",@cell)> 0)) < SUM(COUNTIFS(CHILDREN([Interface Name]1), OR(FIND("Coding Program",@cell)> 0, FIND("Modify",@cell)> 0, FIND("Development",@cell)> 0)))), COUNTIFS(CHILDREN([% Complete]1), <1, CHILDREN([% Complete]1), >0, CHILDREN([Interface Name]1), OR(FIND("Coding Program",@cell)> 0, FIND("Modify",@cell)> 0, FIND("Development",@cell)> 0))), 1)

    I tried here and in other sheets to use the LOWER(@cell)functionality but I didn't get what I was expecting. The idea is to search in all the cells of the referenced column without differentiate between uppercase and lowercase words, right? For example, I want to search for the status project : "Complete", and this should be equal to "COMPLETE". Because it didn't work properly, I created this= ...OR(FIND("Complete",@cell)> 0, FIND("COMPLETE",@cell)> 0)

    Thank you so much again and have an amazing day!

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Glad you were able to find a working solution. In your particular examples above you would use something like this for the LOWER function...

    FIND("complete", LOWER(@cell))> 0

    你在做什么是转换e的内容ach individual cell to lower case then using it in the FIND function within the rest of your formula. Just be sure that the text you use to specify what you are looking for is in all lower case as well.

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

    No worries!

    Happy to help!

    Best,

    Andrée

    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.

  • Thank you! I'll use it soon and certainly it will work well!:)

  • I realize that this is an old thread, but I had a similar question that I think I figured out a novel approach. I wanted the level of the hierarchy, i.e. 0=Top, 1=Child, 2=Grandchild, etc. You can then use that to figure out the rest of your issue.

    I ended up using this formula:

    =IF(COUNT(PARENT()) = 0, 0, PARENT() + 1)


    If you wanted to start your count at 1 (i.e., 1= Top, 2= Child, 3= Grandchild, etc...

    =IF(COUNT(PARENT()) = 0, 1, PARENT() + 1)

    Hope this helps someone!

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

    Hi@Matthew Walkup

    Thanks for sharing!

    I usually use this one.

    =IF(COUNT(CHILDREN(Task@row)) > 0; COUNT(ANCESTORS()) + 1)

    I hope that helps!

    Be safe and have a fantastic weekend!

    Best,

    Andrée Starå

    Workflow Consultant / CEO @WORK BOLD

    Did my post(s) help or answer your question or solve your problem? Please help the Community bymarking it as the accepted answer/helpful. 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.

Fixed, needed to add \"Value\" before the formula to remove the apostrophe.<\/p>


<\/p>

=VALUE(IFERROR(JOIN(DISTINCT(COLLECT([Customer PO Amount (USD)]@row:[Customer PO Amount (Local Currency)]@row, [Customer PO Amount (USD)]@row:[Customer PO Amount (Local Currency)]@row, <>\"\"))), \" \"))<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","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":109460,"type":"question","name":"IF \/ OR formula then Check a Box","excerpt":"I need a formula that IF a specific column has either 1 of 2 specific choices, then a BOX in another column is checked: =IF(([Study Status]@row = \"Active\/ Open to Accrual\", 1) OR([Study Status]@row = \"In Start-Up\", 1))","snippet":"I need a formula that IF a specific column has either 1 of 2 specific choices, then a BOX in another column is checked: =IF(([Study Status]@row = \"Active\/ Open to Accrual\", 1)…","categoryID":321,"dateInserted":"2023-08-25T13:30:39+00:00","dateUpdated":null,"dateLastComment":"2023-08-25T16:21:27+00:00","insertUserID":9250,"insertUser":{"userID":9250,"name":"Susan Swisher","url":"https:\/\/community.smartsheet.com\/profile\/Susan%20Swisher","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-25T16:23:49+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"updateUserID":null,"lastUserID":161714,"lastUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-26T01:04:51+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":9,"countViews":45,"score":null,"hot":3385956126,"url":"https:\/\/community.smartsheet.com\/discussion\/109460\/if-or-formula-then-check-a-box","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109460\/if-or-formula-then-check-a-box","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109460,"commentID":392616,"name":"Re: IF \/ OR formula then Check a Box","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392616#Comment_392616","dateInserted":"2023-08-25T16:21:27+00:00","insertUserID":161714,"insertUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-26T01:04:51+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":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T15:13:03+00:00","dateAnswered":"2023-08-25T14:14:39+00:00","acceptedAnswers":[{"commentID":392575,"body":"

Give this a try:<\/p>

=IF(OR([Study Status]@row = \"Active\/Open to Accrual\", [Study Status]@row = \"In Start-Up\"), 1)<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","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":109457,"type":"question","name":"Conditional Formatting (modified date not in the last 3 weeks)","excerpt":"I would like to use Conditional Formatting (highlight the entire row yellow) if the modified date is not within the last 3 weeks. So any row that has not been recently updated (last 3 weeks) should be highlighted in yellow. Is this spmething that can be done directly within conditional formatting or should I first create a…","snippet":"I would like to use Conditional Formatting (highlight the entire row yellow) if the modified date is not within the last 3 weeks. So any row that has not been recently updated…","categoryID":321,"dateInserted":"2023-08-25T12:33:14+00:00","dateUpdated":null,"dateLastComment":"2023-08-25T12:40:57+00:00","insertUserID":161267,"insertUser":{"userID":161267,"name":"Jef Snyders","title":"Jef Snyders","url":"https:\/\/community.smartsheet.com\/profile\/Jef%20Snyders","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/4HJAEW33KBD0\/nXEKEZE5EQEV4.jpg","dateLastActive":"2023-08-25T13:32:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":161267,"lastUser":{"userID":161267,"name":"Jef Snyders","title":"Jef Snyders","url":"https:\/\/community.smartsheet.com\/profile\/Jef%20Snyders","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/4HJAEW33KBD0\/nXEKEZE5EQEV4.jpg","dateLastActive":"2023-08-25T13:32:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":26,"score":null,"hot":3385935251,"url":"https:\/\/community.smartsheet.com\/discussion\/109457\/conditional-formatting-modified-date-not-in-the-last-3-weeks","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109457\/conditional-formatting-modified-date-not-in-the-last-3-weeks","format":"Rich","tagIDs":[437],"lastPost":{"discussionID":109457,"commentID":392553,"name":"Re: Conditional Formatting (modified date not in the last 3 weeks)","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392553#Comment_392553","dateInserted":"2023-08-25T12:40:57+00:00","insertUserID":161267,"insertUser":{"userID":161267,"name":"Jef Snyders","title":"Jef Snyders","url":"https:\/\/community.smartsheet.com\/profile\/Jef%20Snyders","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/4HJAEW33KBD0\/nXEKEZE5EQEV4.jpg","dateLastActive":"2023-08-25T13:32:31+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":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T12:40:09+00:00","dateAnswered":"2023-08-25T12:37:47+00:00","acceptedAnswers":[{"commentID":392551,"body":"

There is no direct way to do this. Adding a checkbox helper column with something similar to this and then formatting based on the checkbox is the simplest way. You can even hide the extra column, as there is no reason for it to be visible.<\/p>

=IF([Modified Date]@row < TODAY(-21), 1, 0)<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","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":437,"urlcode":"conditional-formatting","name":"Conditional Formatting"}]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=321&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":4991,"limit":3},"title":"Trending in Smartsheet Basics","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

Trending in Smartsheet Basics