Join Ancestors help
I have a sheet that has a Task Name column which has Parent and Child rows. I have another column "Levels" that tells me the level that each row sits in the hierarchy. My formula does everything except include the data for task names that are at Level 4. I cannot figure out where I am going wrong. Any help is greatly appreciated.
=IF([email protected]= 2,任务名称@row,如果[email protected]= 3, INDEX(ANCESTORS([Task Name]@row), 1) + " - " + PARENT([Task Name]@row), IF([email protected]= 4, INDEX(ANCESTORS([Task Name]@row), 1) + " - " + INDEX(ANCESTORS([Task Name]@row), 2) + " - " + PARENT([Task Name]@row), IF([email protected]= 5, INDEX(ANCESTORS([Task Name]@row), 1) + " - " + INDEX(ANCESTORS([Task Name]@row), 2) + " - " + INDEX(ANCESTORS([Task Name]@row), 3) + " - " + PARENT([Task Name]@row), ""))))
Best Answers
-
Paul Newcome ✭✭✭✭✭✭
Try this instead...
=JOIN(ANCESTORS([Task Name]@row), " - ") + " - " + [Task Name]@row
-
Paul Newcome ✭✭✭✭✭✭
Happy to help.️
To get it working only when another column is checked, you would use it in a straightforward IF statement.
=IF([Checkbox Column Name]@row = 1,original_formula)
=IF([Checkbox Column Name]@row = 1,JOIN(ANCESTORS([Task Name]@row), " - ") + " - " + [Task Name]@row)
Answers
-
J Tech ✭✭✭✭✭
Assuming that the "Levels" column is accurate, one way to modify the formula to include level 4 tasks could be to add another nested IF statement to handle that level, like this:
=IF([email protected]= 2,任务名称@row,如果[email protected]= 3, INDEX(ANCESTORS([Task Name]@row), 1) + " - " + PARENT([Task Name]@row), IF([email protected]= 4, INDEX(ANCESTORS([Task Name]@row), 1) + " - " + INDEX(ANCESTORS([Task Name]@row), 2) + " - " + PARENT([Task Name]@row), IF([email protected]= 5, INDEX(ANCESTORS([Task Name]@row), 1) + " - " + INDEX(ANCESTORS([Task Name]@row), 2) + " - " + INDEX(ANCESTORS([Task Name]@row), 3) + " - " + PARENT([Task Name]@row), ""))))
This new nested IF statement would go between the existing level 3 and level 5 IF statements, and would handle level 4 tasks by concatenating the first three ancestors of the current task (which should be at levels 1, 2, and 3), along with the parent task name.
Regards
J Tech
If my response has helped you in any way or provided a solution to your problem, please consider supporting the community by marking it as Insightful, Vote Up, or Awesome. Additionally, you can mark it as the accepted answer, which will make it easier for others to find a solution or get help with a similar issue in the future. Your support is greatly appreciated!
-
Paul Newcome ✭✭✭✭✭✭
Try this instead...
=JOIN(ANCESTORS([Task Name]@row), " - ") + " - " + [Task Name]@row
-
NickEL ✭
@Paul NewcomeI don't know how this formula worked when the full paragraph one didn't but thank you so much. This is a reminder for me to K.I.S.S. (Keep It Simple Stupid).
-
NickEL ✭
Please disregard. I figured it out. Again, thank you for all of your help
Also, one more question if I may. Is there any way to get this to only work when a box is checked in another row?
-
Paul Newcome ✭✭✭✭✭✭
Happy to help.️
To get it working only when another column is checked, you would use it in a straightforward IF statement.
=IF([Checkbox Column Name]@row = 1,original_formula)
=IF([Checkbox Column Name]@row = 1,JOIN(ANCESTORS([Task Name]@row), " - ") + " - " + [Task Name]@row)
-
NickEL ✭
Hello. I am back again. I'm not sure if the correct protocol is to start a new discussion or to continue this one since it builds off of the topics in my OP.
I ran into a problem where the formula returns unparseable if there are only parent and child but no ancestor data. Wouldn't Parent data be considered Ancestor data to the child data? Also, since I am losing the battle to maintain data standardization in my company is there any way to amend the original if statements to search for either [Task Name]@row or [Document Name]@row?
Thank you in advance for your help.
-
Genevieve P. Employee Admin
Hey@NickEL
Yes, a Parent row is considered an Ancestor. Can you post a screen capture with the formula open in your sheet (but block out sensitive data)?
In regards to flexible column names, there may be a way to do this but the sheet would need to have both Task Name and Document Name as column titles. This is because a formula will error if the column name typed in it doesn't exist - preventing it from reviewing the other statements.
-
NickEL ✭
@Genevieve P.I was working on this last night and this morning and have figured it out. There was an extra space in the formula. I appreciate your reply as it got me to think things through and check everything again.
-
Genevieve P. Employee Admin
Glad to hear you were able to figure it out!
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/102774/\")<\/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":36,"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":"