Parent/Child Formula for Levels

I am trying to create a parent child formula to deliver numbered levels. The formula I have so far is working for a couple of levels but not 4-5 levels deep (see example). I've worked on this and have now confused myself so needing a bit of helping getting out of my own 'circular reference'
=IF(OR(COUNT(ANCESTORS(Task@row)) = 0, COUNT(CHILDREN(Task@row)) > 0), 1, IF(COUNT(ANCESTORS(Task@row)) > 0, 2))
Best Answer
Answers
-
-
Oh my gosh! I was totally overthinking it. That worked perfectly. Thanks for the quick response
-
@Paul Newcome have you experienced the Count(Ancestors(Task@row)) fails to count an ancestor if the task is blank; for example in a situation when Control Centre will be used to populate the task?
-
@PeggyLang Yes. Task@row should be referencing a column that will always have data in it. You can insert a hidden auto-number column if needed to do this.
-
@Paul Newcome Great to know. I thought I was going crazy. I did end up inserting prefix data, I.E. 'Store #' such that my Levels column was calculating correctly. I use the levels column for a few things and one of which is conditional formatting.
Thanks again for confirming what I was seeing.
Help Article Resources
Categories
Check out the Formula Handbook template!