Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in


How to count cells/records by group in Excel?

For example you have a sales person table, and you want to group and count these sales persons by country as below screenshots shown. Here I will introduce two methods to solve this problem easily.

Count cells/records by group with COUNTIF function

Count cells/records by group with Kutools for Excel



Easily vlookup and sum, count, average lookup findings in Excel

Kutools for Excel’s Advanced Combine Rows utility can help Excel users to batch sum, count, and average based on duplicate items in one column (the Fruit Column in our case), and then delete the duplicate rows based on this column (the Fruit Column) easily as below screenshot shown:

ad advanced combine rows sum

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 30 days. Read More      Free Download Now

arrow blue right bubble Count cells/records by group with COUNTIF function

As you see, the sales persons in above table are unique. Therefore, we can list only unique countries and then count sales persons based on these unique countries with the COUNTIF function. Please do as follows:

1. Copy the Country column (which you will count by), and paste it to a blank column. In our case, we pasted the Country column in Column E.

2. Keep selecting the new pasted column, and click Data > Remove Duplicates.

3. In the opening Remove Duplicates dialog box, click the OK button.

Another dialog box comes out and shows how many duplicates have been removed. Just close this dialog box.

Till now we have listed the unique countries in the Column E.

4. Select a blank cell besides the unique country list, says Cell F2, enter the formula =COUNTIF($A$1:$A$24,E2) into it, and then drag this cell’s Fill Handle to apply this formula to the range as you need.

doc count by group 6

Note: In above formula, $A$1:$A$24 is the country column in original sales person table, and E2 is the country in the unique country list that you will count by.
So far we have counted these sales persons by country as below screenshot shown:

arrow blue right bubble Count cells/records by group with Kutools for Excel

The second method will introduce Kutools for Excel’s Advanced Combine Rows utility to simplify your counting work, and batch count cells/records by groups with several clicks in Excel. Please do as follows:

Kutools for Excel - Combines more than 300 Advanced Functions and Tools for Microsoft Excel

1. Select the sales person table, and click Kutools > Content > Advanced Combine Rows. See screenshot:

2. In the opening Combine Rows Based on Column dialog box, please do as below screenshot shown:

(1) Select the Country column (the column you will count by), and click the Primary Key button;

(2) Select the Sales Person column (the column you will count), and click Calculate > Count.

(3) Set combining rules for other columns based on your needs.

Kutools for Excel - Includes more than 300 handy Excel tools. Full feature free trial 60-day, no credit card required! Get it now!

3. Click the Ok button. Then you will see the sales persons have been counted by country as below screenshot shown:

arrow blue right bubbleRelated articles:

Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.