I can accomplish this task fairly easily with a pivot table or a macro but wanted to see if a formula could be used so it is dynamic.
Given a table starting in A1, B1 like this
[TABLE="width: 96"]
<tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Project
[/TD]
[TD="width: 64, bgcolor: transparent"]Level
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]1
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]3
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]3
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]1
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]4
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]CCC
[/TD]
[TD="bgcolor: transparent, align: right"]1
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]CCC
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]CCC
[/TD]
[TD="bgcolor: transparent, align: right"]3
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]DDD
[/TD]
[TD="bgcolor: transparent, align: right"]1
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]DDD
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]DDD
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
</tbody>[/TABLE]
Create a formula in D2 and E2 drag down to list the subset of Projects that have two or more level 2 items and the number of level 2 items. So for the example above the it would look like:
[TABLE="width: 140"]
<tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Proj
[/TD]
[TD="width: 122, bgcolor: transparent"]Number of Level 2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]3
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]DDD
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
</tbody>[/TABLE]
because AAA has two level 2s, BBB has three, and DDD has two. CCC is not listed because it only has one level 2 item listed.
The projects will always be contiguous (i.e., all AAAs together, not scattered) and all will start with a single level 1 item (no multiple level 1 items). Assume the Table is sorted so the Project names are smallest to largest and the levels for each project are smallest to largest (as depicted in the example).
My shot at a formula involved a matrix which could work on a small data set but is unworkable on large data sets (actual case in question has about 11000 rows).
Given a table starting in A1, B1 like this
[TABLE="width: 96"]
<tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Project
[/TD]
[TD="width: 64, bgcolor: transparent"]Level
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]1
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]3
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]3
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]1
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]4
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]CCC
[/TD]
[TD="bgcolor: transparent, align: right"]1
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]CCC
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]CCC
[/TD]
[TD="bgcolor: transparent, align: right"]3
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]DDD
[/TD]
[TD="bgcolor: transparent, align: right"]1
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]DDD
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]DDD
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
</tbody>[/TABLE]
Create a formula in D2 and E2 drag down to list the subset of Projects that have two or more level 2 items and the number of level 2 items. So for the example above the it would look like:
[TABLE="width: 140"]
<tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Proj
[/TD]
[TD="width: 122, bgcolor: transparent"]Number of Level 2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AAA
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]BBB
[/TD]
[TD="bgcolor: transparent, align: right"]3
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]DDD
[/TD]
[TD="bgcolor: transparent, align: right"]2
[/TD]
[/TR]
</tbody>[/TABLE]
because AAA has two level 2s, BBB has three, and DDD has two. CCC is not listed because it only has one level 2 item listed.
The projects will always be contiguous (i.e., all AAAs together, not scattered) and all will start with a single level 1 item (no multiple level 1 items). Assume the Table is sorted so the Project names are smallest to largest and the levels for each project are smallest to largest (as depicted in the example).
My shot at a formula involved a matrix which could work on a small data set but is unworkable on large data sets (actual case in question has about 11000 rows).