Hi there, I hope the following is not too confusing
I have some data organised in a hierarchy format for a life cycle inventory which I am having trouble sub totalling on different hierarchy levels
It is basically organised as such:
Value Level Subtotal Level 1 1 Level 2 300 2 Level 2 2 Level 3 25 3 Level 3 140 3 Level 2 80 2 Level 1 1 Level 2 2 Level 3 40 3
I am using the level column to lookup the hierarchy level and use it in my calculations.
Where a level has no subcategories, it has it's own value. Where a level does have subcategories (as with the second level 2 entry, it has 2 level 3 entries below it) I want the subtotal column to sum those levels.
So far I have got some of this to work. I can get the level 2 categories which are followed by a level 3 category to sum all of the level 3 categories using sumproduct and generating true/false arrays to multiply by the values, but I am having trouble getting the formula to stop. Ie, I want the level 2 subtotal to include the level 3 lines below it, but I don't want to include the level 3 line on the last row because that belongs to a different level 2 category.
My thought on doing this was to try and create a criteria that tested whether the min of all index levels between the row containing the formula and the row considered for summation were greater than the index level containing the formula. Ie, if we're summing level 3's, is there a 2 above this cell? in which case, stop summing 3's. That however requires the range to be tested to grow as we go further down the sheet.
Does that make sense?
Any help would be greatly appreciated
Tad
Bookmarks