How to Calculate a Percentage With COUNTIF in Excel
By ExcelReady TeamUpdated 6 min read
The short answer
To calculate a percentage with COUNTIF, divide the matching count by the total count: =COUNTIF(C2:C9,"Pass")/COUNTA(C2:C9). Then format the cell as a percentage (Ctrl+Shift+%) so 0.625 shows as 62.5%. Don't multiply by 100 as well. For a percentage within one group, divide COUNTIFS by COUNTIF.
Key takeaways
- The pattern is =COUNTIF(range, criteria)/COUNTA(range): matches divided by the total.
- Format the result as a percentage. Multiplying by 100 and then formatting as % shows 6250% instead of 62.5%.
- COUNTA counts only filled cells, so blank rows don't lower the percentage.
- For a rate inside a group, use =COUNTIFS(group, "Sales", result, "Pass")/COUNTIF(group, "Sales").
- Wrap the formula in IFERROR when the total could be 0, to avoid #DIV/0!.
On this page+
To get a COUNTIF percentage in Excel, count the cells that match, divide by the total number of cells, and format the result as a percentage: =COUNTIF(C2:C9,"Pass")/COUNTA(C2:C9). That one pattern answers questions like "what share passed?", "what percent said Yes?" and "how many orders were late, as a percentage?". This guide walks through it on a small table, then covers groups, blanks and the errors that trip people up.
The COUNTIF percentage formula#
A percentage is a part divided by a whole. COUNTIF gives you the part, and COUNTA gives you the whole:
=COUNTIF(range, criteria)/COUNTA(range)- COUNTIF counts the cells that match your condition, such as "Pass". See the complete guide to COUNTIF for every kind of criteria.
- COUNTA counts every cell that isn't empty, so it gives the total number of entries.
All the examples use this table of test results in A1:D9:
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Candidate | Department | Result | Score |
| 2 | Lena | Sales | Pass | 82 |
| 3 | Marco | Finance | Fail | 54 |
| 4 | Nia | Sales | Pass | 77 |
| 5 | Omar | HR | Pass | 91 |
| 6 | Priya | Finance | Pass | 68 |
| 7 | Quinn | Sales | Fail | 49 |
| 8 | Rosa | HR | Pass | 73 |
| 9 | Sam | Finance | Fail | 58 |
How to calculate the pass rate step by step#
To find the share of candidates who passed:
- Click an empty cell, for example F2.
- Type
=COUNTIF(C2:C9,"Pass"). On its own, this returns 5. - Type
/COUNTA(C2:C9). COUNTA returns 8. - Press Enter. The cell shows 0.625.
- Format it as a percentage: press Ctrl+Shift+% (the same keys work on a Mac), or click % in the Home tab. It now shows 63%.
The full formula is:
=COUNTIF(C2:C9,"Pass")/COUNTA(C2:C9)Why 63% and not 62.5%? The Percentage button shows no decimal places, so Excel rounds the display. The cell still holds 0.625. Click Increase Decimal once to see 62.5%.
The fail rate works the same way: =COUNTIF(C2:C9,"Fail")/COUNTA(C2:C9) returns 0.375, or 37.5%. The two always add up to 100%.
How to show the result as a percentage#
Keep the value as a decimal and let the format do the work. These are the three common ways to display it:
| What you want | Formula | Shows |
|---|---|---|
| A real number, formatted as % | =COUNTIF(C2:C9,"Pass")/COUNTA(C2:C9) | 62.5% (with one decimal) |
| A rounded number | =ROUND(COUNTIF(C2:C9,"Pass")/COUNTA(C2:C9),2) | 63% (stored as 0.63) |
| Text for a sentence or label | =TEXT(COUNTIF(C2:C9,"Pass")/COUNTA(C2:C9),"0%") | 63% (as text) |
The most common mistake is multiplying by 100 and applying the Percentage format. The format already multiplies by 100 for display, so 62.5 becomes 6250%. Pick one: either multiply by 100 and leave the cell as a plain number, or divide only and format as %. The second is better, because other formulas can use the value directly. The guide to the Excel percentage formula explains how Excel stores percentages.
How to find the percentage of values above a number#
Put the comparison inside the COUNTIF criteria, in quotes. To find the share of candidates who scored 75 or more:
=COUNTIF(D2:D9,">=75")/COUNT(D2:D9)Three scores are 75 or higher (82, 77 and 91), out of 8, so the result is 37.5%. Here COUNT is the better total, because it counts only numbers. That keeps a stray text note like "absent" out of the total.
To compare against a cell, join the operator with &. If G1 holds the target score:
=COUNTIF(D2:D9,">="&G1)/COUNT(D2:D9)How to calculate a percentage within a group#
Use COUNTIFS for the part and COUNTIF for the group total. To find the pass rate in Sales only:
=COUNTIFS(B2:B9,"Sales",C2:C9,"Pass")/COUNTIF(B2:B9,"Sales")Sales has three candidates and two passed, so the result is 66.7%. For Finance it is 33.3% (1 of 3), and for HR it is 100% (2 of 2).
Be clear about which question you're answering:
- "What share of Sales candidates passed?" Divide by the number of Sales candidates: 2 ÷ 3 = 66.7%.
- "What share of all passes came from Sales?" Divide by all passes: 2 ÷ 5 = 40%.
Both are valid, and they give very different numbers. The second kind is a share of a total, explained in how to calculate a percentage of total.
How to handle blank cells and #DIV/0!#
COUNTA ignores truly empty cells, so a candidate who hasn't taken the test yet doesn't drag the rate down. If C10 were blank, =COUNTIF(C2:C10,"Pass")/COUNTA(C2:C10) would still return 62.5%. If you divided by ROWS(C2:C10) instead, the blank row would count, and you'd get 5 ÷ 9 = 55.6%.
Two cautions:
- Cells that look empty may not be. A cell with a space, or a formula that returns
"", is counted by COUNTA. The article on COUNTIF for non-blank cells shows how to count only cells with real content. - An empty column gives #DIV/0!. If COUNTA returns 0, the division fails. Wrap the formula:
=IFERROR(COUNTIF(C2:C9,"Pass")/COUNTA(C2:C9),0).
Common COUNTIF percentage mistakes#
Check these when the percentage looks wrong:
- Wrong total range. The two ranges should cover the same rows.
COUNTIF(C2:C9,…)/COUNTA(C2:C20)divides by too many cells. - Including the header.
COUNTA(C1:C9)counts the word "Result" too, giving 5 ÷ 9 instead of 5 ÷ 8. - Extra spaces in the data. "Pass " with a trailing space doesn't match "Pass". Clean the column with TRIM.
- Spelling variants. "Passed" and "Pass" are different words. Use a wildcard,
"Pass*", to catch both. - Yes/No columns. The same pattern works:
=COUNTIF(B2:B20,"Yes")/COUNTA(B2:B20). See how to count Yes in Excel for more Yes/No tricks.
The COUNTIF function guide and the COUNTA function guide are quick syntax references.
Practise it#
COUNTIF percentages combine two skills that job tests check all the time: counting with a condition and formatting a result as a percentage. Practise COUNTIF in a live spreadsheet, then practise percentages and percent change. Each lesson checks your formula instantly. Then try the exercise on this page and work out the pass rate yourself.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
What share of candidates passed? Click F2, divide a COUNTIF of Pass in C2:C9 by COUNTA of the same range, then press Enter.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Score | ||||||
| 2 | Pass rate | ||||||
| 3 | |||||||
| 4 | |||||||
| 5 | |||||||
| 6 | |||||||
| 7 | |||||||
| 8 | |||||||
| 9 | |||||||
| 10 | |||||||
| 11 | |||||||
| 12 |
Tip: COUNTIF(C2:C9,"Pass") counts the passes. COUNTA(C2:C9) counts every result. Divide the first by the second.
Practise this in a lesson
Frequently asked questions
How do I calculate a percentage with COUNTIF in Excel?
Divide the COUNTIF result by the total number of entries, for example =COUNTIF(C2:C9,"Pass")/COUNTA(C2:C9). Then apply the Percentage format to the cell.
Why does my COUNTIF percentage show 6250%?
You multiplied by 100 and also applied the Percentage format, which multiplies by 100 again. Remove the *100 and keep the Percentage format, and 0.625 displays as 62.5%.
Should I divide by COUNTA or ROWS?
Divide by COUNTA if some cells may be blank and you only want to count filled ones. ROWS counts every row in the range, including blanks, which lowers the percentage.
How do I find the percentage of cells that say Yes?
Use =COUNTIF(B2:B20,"Yes")/COUNTA(B2:B20) and format the cell as a percentage. COUNTIF is not case-sensitive, so yes, Yes and YES all count.
How do I stop a #DIV/0! error in a COUNTIF percentage?
The error appears when the total is 0, for example when the column is empty. Wrap the formula: =IFERROR(COUNTIF(C2:C9,"Pass")/COUNTA(C2:C9),0), or return "" to show a blank cell.