I have a huge unbalanced panel data. I want to count number of rows within each group. For example, I have the following data: data ={{AA,1,10},{AA,2,20},{CC,3,30},{CC,4,40},{CC,5,50},{CC,6,60},{CC,7,70},{DD,8,80}, {DD,9,90},{DD,10,100}}; I want to calculate number of rows within each group without using do loop. My result should be result={{AA,2},{CC,5},{DD,3}}; Any help is greatly appreciated.