Capture.JPG

I have excel sheet with 3 columns Groups, Sub groups, Sub Sub groups

then, I have another table with list of main groups, where for each main group I want to count how many sub groups / sub sub groups are under.

Main Group Sub Groups Main Group Count of sub groups
A M1 A 2
A M1 B 1
A M2 C 3
B U1 D 1
B U1
B U1
C L3
C L4
C L5
D L6