Summary
To generate a count by category with a percentage breakdown, you can use the GROUPBY function together with the PERCENTOF function. In the example shown, the formula in D4 is:
=GROUPBY(B5:B16,--(B5:B16<>""),HSTACK(COUNT,PERCENTOF),0)
The result is a summary table that spills into D4:F10, with a count and a percentage for each category, plus a total row. The results in column F are decimal values with the percentage number format applied. GROUPBY and PERCENTOF are only available in Excel 365. In other versions, you can use COUNTIF and COUNTA instead.
Generic formula
=GROUPBY(range,--(range<>""),HSTACK(COUNT,PERCENTOF),0)
Explanation
In this example, the goal is to calculate a count and percentage for each category shown in column B.
Why not a pivot table?
A pivot table is also a good way to solve this problem, and it works in any version of Excel. See Pivot table count with percentage for the steps. The main difference is that a pivot table must be refreshed to pick up changes in the data, while the formulas below update automatically.
Count and percentage with GROUPBY
The GROUPBY function can summarize data with a single formula, so there is no need to type in a list of categories. To get a count and a percentage for each category, we might try a formula like this:
=GROUPBY(B5:B16,B5:B16,HSTACK(COUNTA,PERCENTOF),0)
The counts are correct, but every result in the PERCENTOF column is a #DIV/0! error. This happens because PERCENTOF needs numbers. It divides the sum of the values in each group by the sum of all values, and since the values in column B are text, both sums are zero.
To fix this problem, we need to give GROUPBY numbers to work with. We don't need anything fancy, just a 1 for each row. This expression creates the 1s we need:
--(B5:B16<>"")
The comparison checks that each cell in B5:B16 is not empty. Since every cell contains a category, it returns 12 TRUE values:
{TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE}
The double negative then converts each TRUE to 1:
{1;1;1;1;1;1;1;1;1;1;1;1}
With this array as the values argument, we can switch from COUNTA to COUNT, since the values are now numbers. The final formula in D4 is:
=GROUPBY(B5:B16,--(B5:B16<>""),HSTACK(COUNT,PERCENTOF),0)
Here are the arguments:
- row_fields - B5:B16, because we want to group by category.
- values - the array of 1s, one for each row.
- function - HSTACK(COUNT,PERCENTOF), because we want a count and a percentage. The HSTACK function puts them side by side.
- field_headers - 0, because B5:B16 doesn't include a header. Be careful with this one: if you use 1 here, GROUPBY treats the first category as a header and leaves it out of the counts.
For each category, COUNT counts the 1s and PERCENTOF divides the sum of the 1s in the group by the sum of all the 1s. Software issue appears in 4 of the 12 rows, so the percentage works out like this:
=PERCENTOF({1;1;1;1},{1;1;1;1;1;1;1;1;1;1;1;1})
=4/12
=0.3333
The result spills into D4:F10. GROUPBY sorts the categories from A to Z and adds a total row, and because we asked for two calculations, it adds the function names as headers in E4:F4. To use your own headers, see GROUPBY with custom headers. The results in column F are decimal values formatted with the Percentage number format.
To sort by count, with the largest count first, set sort_order to -2:
=GROUPBY(B5:B16,--(B5:B16<>""),HSTACK(COUNT,PERCENTOF),0,,-2)
If you plan to add more rows, put the data in an Excel Table and use a structured reference like Tickets[Category] in place of B5:B16, so the range grows with the data. For a longer walkthrough of this approach, including a custom sort order, see GROUPBY with survey results.
If the range contains empty cells, GROUPBY returns an extra group labeled 0. To leave out empty cells, provide the same test as filter_array:
=GROUPBY(B5:B16,--(B5:B16<>""),HSTACK(COUNT,PERCENTOF),0,,,B5:B16<>"").
Count and percentage with COUNTIF and COUNTA
Another way to solve this problem is with the COUNTIF function and the COUNTA function, which work in any version of Excel. This approach needs a typed list of categories, which is also its advantage: you can put the categories in any order and include a category that has no rows yet. In the worksheet below, the categories are in D5:D9. To generate the count, we use COUNTIF. The formula in E5, copied down, is:
=COUNTIF($B$5:$B$16,D5)
The range is B5:B16, entered as an absolute reference so that it doesn't change when the formula is copied. The criteria is supplied as a reference to D5, which picks up the text value in column D. As the formula is copied down, it returns the count of each category listed in D5:D9.
To calculate the percentage shown in column F, we need to divide the count per category by the total count. The formula in F5 is:
=COUNTIF($B$5:$B$16,D5)/COUNTA($B$5:$B$16)

On the left, COUNTIF is configured as explained above. On the right, we use COUNTA to count total values in B5:B16 to generate a total count. The formula is evaluated like this:
=COUNTIF($B$5:$B$16,D5)/COUNTA($B$5:$B$16)
=4/12
=0.3333
The results in column F are decimal values formatted with the Percentage number format.
A category missing from the typed list isn't counted, so the percentages no longer add up to 100%. The total in F10 is a quick way to check. With one row changed to a new category, it returns 91.7%.
Note: since we already have a count per category in column E, it would be more efficient to pick up that count in this formula instead of recalculating the same count again in column F. However, COUNTIF and COUNTA are shown together here as a standalone solution.