Index/Collect from Descendants
In this sheet, I have a column [Groups] which is a parent column to multiple "Groups", each of which is a parent column itself to tasks associated with each group.
I need help putting a formula in [Start Date] of the parent row that would give me the very 1st value from [Date] column that is a Descendant of [Groups]@row
This formula gives me the correct row # from the Groups column
=INDEX(DESCENDANTS(Groups@row), 2)
This formula is giving me an error
=INDEX([Date]:[Date], DESCENDANTS(Groups@row), 2)
Thanks in advance!
Best Answer
-
Hey @Leeweber
I was hoping to do this without adding a helper column but I could not. Unfortunately my original formula isn't really working - it is only pulling the first date which coincidentally was your minimum. My mistake.
This helper column is one I always add to my sheets when I have hierarchies that begin to include grandparents and beyond. Uncreatively, I call this helper "Level". As with most helper columns you can push this column to the far right and hide, if desired.
Level
=COUNT(ANCESTORS())
This is an easy way of designating specific levels of hierarchy in both formulas and Reports. It's also the only way to gather the data if using cross sheet references.
Your desired formula is then much easier:
=IF(AND(COUNT(CHILDREN(Groups@row)) > 0, Level@row=0), MIN(COLLECT(Date:Date, Date:Date, ISDATE(@cell), LEVEL:LEVEL, @cell = 2)))
And you can swap the MIN and MAX for th e END Date calculation or easily gather a different level of hierarchy.
Will this work for you?
Kelly
Answers
-
Hey @Leeweber
Try this:
=IF(AND(COUNT(CHILDREN(Groups@row)) > 0, COUNT(ANCESTORS(Groups@row)) = 0), MIN(COLLECT(Date:Date, Date:Date, ISDATE(@cell ), Date:Date, @cell = INDEX(DESCENDANTS(Date@row), 2))))
I wrote the formula this way to givh1, Group 2, etc individual groups. This formula will allow you build additional IFs onto the formula. If you need the End Date, it is the same formula but swapping MAX for MIN.
Will the formula above work for you?
Kelly
-
Your formula works perfect for collecting the start date, thank you!
Could you kindly assist with getting end date?
Just changing MIN to MAX in the formula you provided still gave me 2-Dec-2024 (possibly because of this part of the formula
@cell = INDEX(DESCENDANTS(Date@row), 2)
I adjusted the formula to this for the "End Date"
=IF(AND(COUNT(CHILDREN(Groups@row)) > 0, COUNT(ANCESTORS(Groups@row)) = 0), MAX(COLLECT(Date:Date, Date:Date, ISDATE(@cell ), Date:Date, @cell = INDEX(DESCENDANTS(Date@row), COUNT(DESCENDANTS(Date@row))))))
But I'm getting 3-Feb-2025 and not 17-Feb-2025.
Please let me know your thoughts 😊
And Happy Thanksgiving!
-
Hey @Leeweber
I was hoping to do this without adding a helper column but I could not. Unfortunately my original formula isn't really working - it is only pulling the first date which coincidentally was your minimum. My mistake.
This helper column is one I always add to my sheets when I have hierarchies that begin to include grandparents and beyond. Uncreatively, I call this helper "Level". As with most helper columns you can push this column to the far right and hide, if desired.
Level
=COUNT(ANCESTORS())
This is an easy way of designating specific levels of hierarchy in both formulas and Reports. It's also the only way to gather the data if using cross sheet references.
Your desired formula is then much easier:
=IF(AND(COUNT(CHILDREN(Groups@row)) > 0, Level@row=0), MIN(COLLECT(Date:Date, Date:Date, ISDATE(@cell), LEVEL:LEVEL, @cell = 2)))
And you can swap the MIN and MAX for th e END Date calculation or easily gather a different level of hierarchy.
Will this work for you?
Kelly
-
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.5K Get Help
- 424 Global Discussions
- 136 Industry Talk
- 465 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 145 Just for fun
- 62 Community Job Board
- 464 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 301 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!