COUNTIFS counts the rows where every condition is true. Give it pairs of a range and a condition: =COUNTIFS(B2:B13,"Gauteng",F2:F13,"No") counts the invoices that are in Gauteng and are not paid. Each extra condition narrows the count. All the ranges must have the same size.
Functions
Excel COUNTIFS: Multiple Criteria, Dates and OR Logic
Try this now
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Company | Country | Record Value (trillions) | |
| 2 | Saudi Aramco | Saudi Arabia | 2.1 | |
| 3 | Apple | USA | 1.426 | |
| 4 | Microsoft | USA | 1.4 | |
| 5 | PetroChina | China | 1 | |
| 6 | Amazon | USA | 1 | |
| 7 | Alphabet | USA | 1 |
You are typing into D1. Refer to the cells that hold the data.
No key for < or > on your keyboard? Use these:
Ready to practice?
Apply what you just learned with interactive exercises.
This page uses one invoice list to cover text and number conditions, date ranges, wildcards, blanks, OR logic, the same-size rule, and the mistakes that make a COUNTIFS return the wrong number or an error.
TL;DR
- The pattern is =COUNTIFS(range1, criteria1, range2, criteria2, ...). Every pair is joined by AND, so a row counts only when all pairs match.
- Every range must have the same number of rows and columns, or the formula returns #VALUE!.
- Use two conditions on one column for a between test: =COUNTIFS(D2:D13,">=1000",D2:D13,"<=2000").
- COUNTIFS cannot do OR on its own. Add two COUNTIFS together, or wrap one in SUM with an array constant.
- Join an operator to a date or a cell with an ampersand: ">="&H1.
Table of Contents
- Sample data: an invoice list
- COUNTIFS syntax
- How to count with two text conditions
- How to count with a text and a number condition
- How to count between two numbers
- How to count between two dates
- How to use cell references as criteria
- How to use wildcards and not equal
- How to count with OR logic
- Why the ranges must be the same size
- COUNTIFS compared with other options
- Excel versions
- Common COUNTIFS errors and wrong counts
- What learners get wrong
- Job scenario: a collections report
- Practice
- FAQ
- Sources
Sample data: an invoice list
Every example uses this list. Row 1 holds headings and the twelve invoices sit in rows 2 to 13.
| Row | A: Invoice | B: Region | C: Rep | D: Amount | E: Due | F: Paid |
| 2 | INV-201 | Gauteng | Naledi | 1200 | 2026-09-15 | Yes |
| 3 | INV-202 | Western Cape | Pieter | 850 | 2026-09-20 | No |
| 4 | INV-203 | KZN | Naledi | 2300 | 2026-09-28 | Yes |
| 5 | INV-204 | Gauteng | Pieter | 640 | 2026-10-03 | No |
| 6 | INV-205 | Gauteng | Naledi | 3100 | 2026-10-08 | No |
| 7 | INV-206 | Western Cape | Naledi | 1500 | 2026-10-12 | Yes |
| 8 | INV-207 | KZN | Pieter | 980 | 2026-10-15 | No |
| 9 | INV-208 | Gauteng | Pieter | 2750 | 2026-10-20 | Yes |
| 10 | INV-209 | KZN | Naledi | 410 | 2026-10-25 | No |
| 11 | INV-210 | Western Cape | Pieter | 1900 | 2026-10-30 | No |
| 12 | INV-211 | Gauteng | Naledi | 1800 | 2026-11-02 | No |
| 13 | INV-212 | KZN | Pieter | 2600 | 2026-11-05 | Yes |
| Cell | Holds |
| H1 | 2026-10-01, the start of a period |
| H2 | 2026-10-31, the end of the period |
| H3 | 2026-10-15, a review date |
| H4 | KZN |
| H5 | Pieter |
COUNTIFS syntax
The pattern is =COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...).
| Argument | Required? | What it does |
| criteria_range1 | Required | The first range to test. |
| criteria1 | Required | The condition for the first range, such as "Gauteng" or ">2000". |
| criteria_range2, criteria2 | Optional | More pairs. Excel accepts up to 127 pairs. |
The criteria use the same rules as COUNTIF: text and operators go in quotes, a cell reference goes without quotes, an operator joined to a cell needs an ampersand, and the match ignores case. The COUNTIF guide lists them in full.
How to count with two text conditions
Use =COUNTIFS(B2:B13,"Gauteng",F2:F13,"No") to count Gauteng invoices that are unpaid. It returns 3, for INV-204, INV-205 and INV-211.
Read it in pairs: column B must equal Gauteng, and column F must equal No. A row that satisfies only one of them does not count.
You can add a third pair without changing the others. =COUNTIFS(B2:B13,"Gauteng",F2:F13,"No",C2:C13,"Naledi") narrows the list to invoices owned by Naledi, which gives 2: INV-205 and INV-211.
One condition only? COUNTIFS still works. =COUNTIFS(B2:B13,"Gauteng") returns 5, the same as COUNTIF. You can use COUNTIFS for every count, so you never have to switch functions when a second condition arrives.
How to count with a text and a number condition
Use =COUNTIFS(B2:B13,"Gauteng",D2:D13,">2000") to count Gauteng invoices above 2000. It returns 2, for INV-205 at 3100 and INV-208 at 2750.
The number condition goes in quotes with its operator. An equal-to number can go bare: =COUNTIFS(D2:D13,2300) counts one invoice.
A related example: =COUNTIFS(C2:C13,"Naledi",F2:F13,"Yes") returns 3, the paid invoices Naledi owns (INV-201, INV-203 and INV-206).
A share is one COUNTIFS divided by one COUNTIF. =COUNTIFS(B2:B13,"Gauteng",F2:F13,"Yes")/COUNTIF(B2:B13,"Gauteng") returns 0.4. Two of Gauteng's five invoices are paid. Format the cell as a percentage to show 40%.
How to count between two numbers
COUNTIFS lets the same range appear twice. That makes a "between" test: =COUNTIFS(D2:D13,">=1000",D2:D13,"<=2000") returns 4, for amounts of 1200, 1500, 1900 and 1800.
The operators decide whether the end values count. With >= and <=, a value of exactly 1000 or exactly 2000 is included. With > and < it is not. Choose on purpose, because the boundary values are where reports get disputed.
You can test the same column against any number of conditions, as long as each condition has its own range argument. Remember that two conditions on one column are joined by AND, so a value must satisfy both.
How to count between two dates
Dates are numbers, so a date range is a between test on the date column. Build each side with an ampersand and the DATE function.
To count invoices due in October 2026: =COUNTIFS(E2:E13,">="&DATE(2026,10,1),E2:E13,"<="&DATE(2026,10,31)) returns 7. Those are the invoices due on 3, 8, 12, 15, 20, 25 and 30 October.
Better still, keep the period in cells so the formula never needs editing. H1 holds 2026-10-01 and H2 holds 2026-10-31, so =COUNTIFS(E2:E13,">="&H1,E2:E13,"<="&H2,F2:F13,"No") counts the unpaid ones due in that period. It returns 5: INV-204, INV-205, INV-207, INV-209 and INV-210.
For an overdue count as of a review date, use "less than" the date. H3 holds 2026-10-15, so =COUNTIFS(E2:E13,"<"&H3,F2:F13,"No") returns 3: INV-202, INV-204 and INV-205 were due before 15 October and are still unpaid. INV-207 is due on the 15th itself, so it is not counted yet.
If you want the review date to move forward by itself, replace H3 with the TODAY function. The count then changes every day you open the file, so the printed number goes out of date. The TODAY function guide explains when that is safe. The date functions guide has the rest of the date tools.
How to use cell references as criteria
Put the values you want to filter on in cells and point at them. H4 holds KZN and H5 holds Pieter, so =COUNTIFS(B2:B13,H4,C2:C13,H5) returns 2, for INV-207 and INV-212.
This is how a small dashboard works. Make H4 and H5 drop-down lists with Data Validation, and the count changes when a user picks a different region or rep. The formula never needs to be touched.
An empty criteria cell is treated as the number 0, not as "anything". If a criteria cell is cleared, a formula like =COUNTIFS(B2:B13,H9,F2:F13,"No") with H9 empty looks for regions equal to 0 and returns 0 instead of everything. Guard against it when users can clear a filter cell.
How to use wildcards and not equal
Wildcards work in COUNTIFS the same way as in COUNTIF. The asterisk stands for any run of characters and the question mark for exactly one.
=COUNTIFS(B2:B13,"*Cape",F2:F13,"No") counts unpaid invoices from regions ending in Cape. It returns 2, for INV-202 and INV-210.
=COUNTIFS(B2:B13,"K*",D2:D13,">900") counts regions starting with K whose amount is above 900. It returns 3: INV-203, INV-207 and INV-212. The wildcard characters guide shows ? and ~ too.
For "not equal", use <>. =COUNTIFS(B2:B13,"<>Gauteng",F2:F13,"No") counts unpaid invoices outside Gauteng and returns 4. Remember that a blank cell is "not equal" to Gauteng too. If a region cell were empty on an unpaid row, that row would be counted, so add a "<>" condition when blanks are possible.
How to count with OR logic
COUNTIFS joins every pair with AND. Two conditions on the same column cannot both be true, so =COUNTIFS(B2:B13,"Gauteng",B2:B13,"KZN") returns 0. No region is both.
For OR logic, count each branch separately and add them. To count unpaid invoices in Gauteng or KZN: =COUNTIFS(B2:B13,"Gauteng",F2:F13,"No")+COUNTIFS(B2:B13,"KZN",F2:F13,"No") returns 5, which is 3 for Gauteng and 2 for KZN.
A shorter way uses an array constant for the words: =SUM(COUNTIFS(B2:B13,{"Gauteng","KZN"},F2:F13,"No")) also returns 5. Excel runs the count once per word and SUM adds the two results. Use it when the list is short and fixed.
If you need AND across columns and OR within one, build the sum as above. If you need a long list of options that changes, put the options in cells and use SUMPRODUCT with COUNTIFS, or filter the data with the FILTER function.
Why the ranges must be the same size
COUNTIFS compares the ranges position by position, so each one needs the same shape. If one range is shorter, Excel cannot line them up and returns #VALUE!.
=COUNTIFS(B2:B13,"Gauteng",F2:F12,"No") is the classic slip. B2:B13 has 12 rows and F2:F12 has 11. The result is #VALUE!.
The cause is usually a range that was extended in one argument and not in the others, or a table that grew after the formula was written. Convert the list to an Excel Table with Ctrl+T so the ranges grow together, as explained in the Tables guide.
Ranges can be on different sheets, as long as the sizes match. They do not have to be in the same columns of the sheet.
COUNTIFS compared with other options
| Method | Use it when | Watch out for |
| COUNTIFS | Two or more AND conditions on ranges | Same-size ranges, no OR |
| COUNTIF | One condition | Cannot combine columns |
| SUMPRODUCT | The test needs a calculation, such as (B2:B13="Gauteng")*(F2:F13="No") | Slower on big ranges |
| FILTER with ROWS | You also want to see the matching rows (Microsoft 365) | Not in Excel 2019 or earlier |
| SUMIFS | You want the total of a column, not the count | Same rules as COUNTIFS |
| Pivot table | You want every combination at once | Needs a refresh |
Excel versions
COUNTIFS arrived in Excel 2007 and is in every later version: 2010, 2013, 2016, 2019, 2021, Microsoft 365, Excel for the web and Excel for Mac. Excel 2003 and earlier do not have it. The behavior of criteria and wildcards is the same across versions.
FILTER, shown in the comparison, needs Microsoft 365 or Excel 2021. If you share a workbook with someone on Excel 2019, stay with COUNTIFS or SUMPRODUCT.
Common COUNTIFS errors and wrong counts
| What you see | Cause | Fix |
| #VALUE! | The ranges are different sizes, such as B2:B13 and F2:F12 | Make every range the same size |
| #VALUE! | A range points to a workbook that is closed | Open the other workbook |
| Excel will not accept the formula | A criteria range has no criterion after it | Give every range its own criterion |
| 0 when you can see matches | Trailing spaces or numbers stored as text | Clean with TRIM, or use a wildcard |
| 0 when you used OR | Two conditions on the same column joined by AND | Add two COUNTIFS together |
| A count far too high | A "<>x" condition on a full column counts every blank cell | Use the exact data range |
| A date test counts nothing | The date was typed as text that Excel did not read as a date | Use the DATE function or a date in a cell |
| The count is wrong after copying down | Ranges slid because they had no dollar signs | Lock them, as in $B$2:$B$13 |
What learners get wrong
Between 26 September and 3 November 2026, learners made 2,714 first attempts across our COUNTIFS Function lesson, and 77.1% were right. The COUNT Skill Summary had 2,464 first attempts, with 72.7% right. A first attempt is the first check of a screen in a page view, not a person. Here are the patterns behind the misses.
Pointing at the wrong column. Asked to count cities whose names start with M where crime is above 1550, only 43.1% of 274 first attempts were right. The accepted answer is =COUNTIFS(A2:A8,"m*",C2:C8,">1550"). The most common wrong answer, with 47 first attempts, was =COUNTIFS(B2:B8,"M*",C2:C8,">1550"): right shape, wrong column, because the city names live in column A. A second screen, counting USA cities with an average July temperature above 90, had 268 first attempts and 60.8% right. It drew =COUNTIFS(A2:A8,"USA",C2:C8,">90") 20 times, but the country sits in column B. Before you type, point at the heading of each column you use.
Forgetting the wildcard. Another 17 first attempts on the city screen wrote =COUNTIFS(A2:A8,"M",C2:C8,">1550"). Without the asterisk, the criteria "M" matches only a cell that is exactly the letter M, so it finds nothing. To match "starts with M", write "M*".
A range with no criterion, or a pair missing. On the US screen, =COUNTIFS(A2:A8,C2:C8,">90") appeared 9 times: the second range stands where the word "USA" should be. =COUNTIFS(C2:C8,">90") appeared 6 times, which drops the country pair and counts every hot city. And =COUNTIFS(A2:B8,"USA",C2:C8,">90") appeared 6 times, a two-column range beside a one-column range, which fails the same-size rule. Count your arguments in pairs.
Using COUNTIF where COUNTIFS is needed. The screen on the number of USA entries with a value above 1 had 287 first attempts, 66.6% right. The wrong =COUNTIF(B2:B7,"USA",C2:C7,">1") came up 25 times. COUNTIF takes one range and one condition. On the summary lesson, =COUNTIF(B2:B8,">10",C2:C8,"<20000") came up 6 times for the same reason. The extra S is the whole difference.
Typing a formula when the screen wants a number. For the question "what would =COUNTIFS(B2:B8,"MO",C2:C8,">2000") return", the answer is 1, and 280 first attempts were 77.1% right. The common wrong answer, 17 first attempts, was the formula itself.
One small miss repeated on the summary lesson: "<2000" instead of "<20000" came up 18 times in 242 first attempts. A dropped zero changes the answer without any error to warn you.
Job scenario: a collections report
Your finance lead wants a short list of numbers for the Monday credit meeting.
- Unpaid invoices overall. =COUNTIFS(F2:F13,"No") returns 7.
- Unpaid by region. =COUNTIFS(B2:B13,"Gauteng",F2:F13,"No") returns 3, and the same formula with "KZN" and "Western Cape" returns 2 and 2. The three add up to 7, so no unpaid invoice is missing a region.
- Overdue at the review date. With 2026-10-15 in H3, =COUNTIFS(E2:E13,"<"&H3,F2:F13,"No") returns 3.
- Big and overdue. Add an amount condition: =COUNTIFS(E2:E13,"<"&H3,F2:F13,"No",D2:D13,">=1000") returns 1, for INV-205 at 3100. That is the one to chase first. INV-202 is 850 and INV-204 is 640.
- October exposure. =COUNTIFS(E2:E13,">="&H1,E2:E13,"<="&H2,F2:F13,"No") returns 5, the unpaid invoices due in October.
Practice
Open Practice Lesson 27 and type each formula as you meet it. Then try Practice Lesson 28, which mixes COUNT, COUNTIF and COUNTIFS so you have to choose the right one. Keep the Excel functions cheat sheet open while you work.
A drill: copy the invoice list into a blank sheet and answer these without looking. How many Western Cape invoices are paid? How many invoices from Pieter are above 1000? How many are due between 1 October and 15 October inclusive? Check each against the pairs-of-range-and-criteria pattern.
FAQ
How do I count with multiple criteria in Excel?
Use COUNTIFS. Write a range and its condition, then another range and its condition: =COUNTIFS(B2:B13,"Gauteng",F2:F13,"No"). A row counts only when every pair is true. Add as many pairs as you need, up to 127, and keep every range the same size, or Excel returns #VALUE!.
What is the difference between COUNTIF and COUNTIFS?
COUNTIF takes one range and one condition. COUNTIFS takes many pairs and counts only rows where all of them match. COUNTIFS also works with a single condition, so you can use it everywhere. The extra S is the difference, and leaving it out is a common cause of errors.
Can COUNTIFS use OR logic?
Not directly, because every pair is joined by AND. Add two COUNTIFS together, such as one for Gauteng and one for KZN. Or use an array constant: =SUM(COUNTIFS(B2:B13,{"Gauteng","KZN"},F2:F13,"No")). Either way, you count each option separately and add the totals. This works because the options cannot overlap.
How do I use COUNTIFS with a date range?
Put the start and end of the range in two conditions on the same date column: =COUNTIFS(E2:E13,">="&H1,E2:E13,"<="&H2). Joining the operator to a cell or a DATE function with an ampersand keeps the formula flexible. Use >= and <= when both ends should be included.
Why does COUNTIFS return #VALUE!?
The ranges are different sizes, or one points to a closed workbook. Check that every range has the same number of rows and columns. For example, B2:B13 and F2:F12 cannot be paired. If you copied the formula between sheets, check that the references still point at the full data.
Does COUNTIFS work with wildcards?
Yes. Use * for any run of characters and ? for one character, for example =COUNTIFS(B2:B13,"*Cape",F2:F13,"No"). To find a real asterisk or question mark, put a tilde in front of it. Wildcards only work on text, not on numbers or dates.
How do I count between two numbers in Excel?
Use the same column twice in COUNTIFS: =COUNTIFS(D2:D13,">=1000",D2:D13,"<=2000"). Both conditions must be true for a value to count, so you get everything from 1000 to 2000 inclusive. Switch to > and < if you want the end values left out.
Sources
Keep going
Guides people read next.

XLOOKUP With Multiple Criteria: 3 Formulas That Work
Use XLOOKUP with two or more conditions in Excel: Boolean, concatenation and OR formulas, last-match tricks, FILTER for all matches, and fixes for errors.
13 minSUMIFS Function in Excel: Sum With Multiple Criteria
Use the SUMIFS function to sum with multiple criteria: AND tests, date ranges, wildcards and OR workarounds, with the argument order that trips people up.
13 minSUMIF Function in Excel: Sum If Text, Numbers, Dates
Learn the Excel SUMIF formula: sum if a cell equals text, passes a number test, matches a wildcard or falls after a date, plus fixes for wrong totals.
16 min