Auto group like cells
Is there a way to auto group cells that are the same, and add a count of them next to the parent cell? For example, I have a sheet that looks like the first screenshot (ex1), it's a list of SKUs within a program and a project. I want to group all SKUs within the same program/project and count the number of SKUs (see ex2).
I found a formula to do this (=COUNT(CHILDREN(Program1)) + " SKUs") but I still need to manually create the parent row, indent the children, copy the formula into the cell, etc., and for a 1000 row sheet, this is a lengthy process.
Is there a better way to achieve what I'm trying to achieve? Can I automate this?