Lesson 4 of 8 · see all lessons
Formulas from zero
Answer questions with conditions and lookups
Organize and summarize the month
12 min
SUMIFS and COUNTIFS in Excel: add and count with conditions
SUMIFS adds only the rows that meet every condition you set; COUNTIFS counts them. Learn both, with text, number, date and wildcard criteria.
By the end of this lesson you can
- Write SUMIFS with the sum range first and one or more conditions
- Use comparisons, <>, wildcards and dates as criteria
- Count matching rows with COUNTIFS
- Avoid the two classic mistakes: mismatched ranges and SUMIF's different order
From earlier lessons · 1 of 2
What does =IF(H2>=30,"Big","Small") show for row 2, where the Total is 28.00?
Pick one answer.
From earlier lessons · 2 of 2
Which test flags weekend rows?
Pick one answer.
The manager has a hunch: weekends carry this café. Ten rows out of thirty doesn't sound like much. Before you agree or argue, you need one number that adds only the weekend rows.
Take a guess
Weekend rows are 10 of the 30 order lines. What share of March revenue do you think they brought in?
No pressure. Guess now, and the lesson will show you if you were right.
SUMIFS: add only the rows that match
SUMIFS adds the cells in one column for the rows where other columns meet your conditions. Its parts:
- sum_range: the numbers to add, such as Total (H2:H31)
- criteria_range1: the column to check, such as Weekend (L2:L31)
- criteria1: what to look for, such as "Weekend"
Add more range-and-criteria pairs for more conditions. A row counts only if it meets every one.
Put in order
Put the parts of the weekend formula in order.
Drag, or focus an item and press Space, move with the arrow keys, then Space to drop.
- ,"Weekend"
- H2:H31
- )
- ,L2:L31
- =SUMIFS(
P10: Weekend revenue Q10: =SUMIFS(H2:H31,L2:L31,"Weekend")P11: Weekend share Q11: =Q10/Q6
Step through
SUMIFS(H2:H31, D2:D31, "Food") walking rows 2 to 13
- Coffee0row
- Food1
- Coffee2
- Food3
- Coffee4
- Tea5
- Coffee6
- Food7
- Coffee8
- Tea9
- Food10
- Coffee11
Start at row 2. Coffee isn't Food, so skip. Running total 0.
=SUMIFS(H2:H31,D2:D31,"Coffee")=SUMIFS(H2:H31,D2:D31,"Coffee",G2:G31,"Ana")
Predict, then reveal
Change one thing: replace "Ana" with "Chloe". Ana and Chloe each have 10 rows. Guess Chloe's coffee total before you look.
Comparisons, wildcards and dates
Criteria can be more than an exact word. Put a comparison in quotes: ">=8" or "<>Coffee" (not Coffee). An asterisk (*) matches any run of characters, and a question mark (?) matches one character. For dates, join the sign to a DATE with an ampersand (&): ">="&DATE(2026,3,16).
=SUMIFS(H2:H31,D2:D31,"<>Coffee")=SUMIFS(H2:H31,C2:C31,"C*")=SUMIFS(H2:H31,A2:A31,">="&DATE(2026,3,16))
What does =SUMIFS(H2:H31,C2:C31,"C*") add up?
Pick one answer.
COUNTIFS: how many rows match
COUNTIFS works like SUMIFS without a sum range. It only takes range-and-criteria pairs and counts the rows where all of them match.
=COUNTIFS(C2:C31,"Latte")=COUNTIFS(D2:D31,"Coffee",E2:E31,">=8")=COUNTIFS(K2:K31,"Big")
How do you count the rows with a Total of at least 15 but under 30?
Pick one answer.
Which formula adds the Totals of Ben's rows?
Pick one answer.
In Google Sheets: SUMIFS and COUNTIFS take the same arguments in the same order, so every formula in this lesson works as written.
FlashcardsIndex cardsFlashcards ⚡
Card 1 of 16Worth keeping
- SUMIFS adds the sum range for rows that meet every condition; the sum range goes first.
- COUNTIFS counts matching rows with the same range-and-criteria pairs.
- Criteria can be text, ">=8", "<>Coffee", "C*" or ">="&DATE(…).
- Keep every range the same size, and point criteria at a cell to reuse the formula.
The manager asks one more money question: what did we actually make on each line? That needs each item's cost, and the costs live in a separate menu list. Copying 30 costs by hand invites typos. One lookup formula fetches them all, until a single stray space returns #N/A.
Embed this practice on your site
Free for classrooms, blogs and study groups. Paste this into any page that accepts HTML.
Report a copyright problem with this lesson
Sources for this lesson (4)
Each fact in the lesson is marked with the number of the page it comes from.