Okay, so I have a sheet that contains a "tree" or hierarchy of a product and all the information about that product. In every row, there is a column called "Level" which indicates where in the tree the piece falls. For example:
Piece Price Level
Car / $1000 / 0
Door / $200 / 1
Window / $150 / 2
Lock / $50 / 2
Roof / $400 / 1
Antenna / $200 / 2
Bike Rack / $200 / 2
So what I want to do is make a macro that recognizes the change in level and SUMS the price of everything in that level. I tried simply using a SUMIF function, but I don't want to SUM every item that is a level 2, only the items that are level 2 UNTIL another level 1.
For example, if I SUMIF'ed the table above and used level 2 as criteria, it would give be $600 because it would do all the level 2's. I only want the level 2's bellow each level one. Because ideally, the price of a level 1 piece would be the SUM of all the pieces that make it up. How can I go about doing this? Is this even possible? Please help, thank you