Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEAThis can also be solved using joins to same table (self join) if you know the depth of hierarchy & depth is smaller.
but using Iterative macro solves the problem of dynamic levels of hierarchy.
Must read question fully before answering! I didn't realise this needed a macro until after I'd solved it and looked at how everyone else had done it. My bad! Anyhoo, it does at least give the output required but I do understand why a macro might be better in real life. And this is definitely one I should come back to and try again using a macro. But for now, here's my more basic solution.
Macro: