COUNTIF, COUNTIFS, SUMPRODUCT: 언제 사용할까요?

조건 하나는 COUNTIF, 여러 조건을 모두 만족해야 하면 COUNTIFS를 사용하세요. 행별 비교, 계산 결과, 대소문자 구분에는 SUMPRODUCT가 유연합니다. 먼저 AND인지 OR인지 정하세요.

목차

빠른 답변

조건 하나는 COUNTIF, 여러 조건을 모두 만족해야 하면 COUNTIFS를 사용하세요. 행별 비교, 계산 결과, 대소문자 구분에는 SUMPRODUCT가 유연합니다. 먼저 AND인지 OR인지 정하세요.

=COUNTIF(A2:A9,"East")

확인 사항

SUMPRODUCT에서 곱셈은 AND, 합산 후 >0은 OR이며 중복 집계도 막습니다. 대소문자는 EXACT, 포함 여부는 ISNUMBER와 SEARCH를 사용하세요. 월별 집계는 해당 월 첫날 이상, 다음 달 첫날 미만으로 지정하세요.

주의점 및 호환성

범위 크기를 맞추고 배열의 전체 열 참조를 피하세요. 와일드카드, 빈 셀과 빈 문자열, 텍스트 숫자, 오류 값에 따라 결과가 달라집니다. COUNTIF는 보통 대소문자를 구분하지 않으므로 EXACT를 대신할 수 없습니다.

영어 상세 예제, 수식 및 작성자 메모

Tested in: Live formula checks in Microsoft Excel 16.114.4 for Mac (English UI; system region zh-Hans_US), November 8, 2026; Google Sheets (spreadsheet locale zh_CN), November 9, 2026. Results and platform differences are noted below; this is not a certification of every menu workflow.

Which versions this applies to

  • COUNTIF and SUMPRODUCT: every Excel version and Google Sheets.
  • COUNTIFS: Google Sheets, and every Excel version Microsoft’s page lists (Excel 2016 through 365, plus Excel for the web).
  • Array constants like {"East","West"} work in Excel. In Google Sheets they may need ARRAYFORMULA (see below).
  • If your region uses commas as decimal separators, use semicolons between arguments.

Example data

Put this in A1:F9:

ABCDEF
1RegionRepProductAmountTargetDate
2EastAnnWidget6005002026-03-02
3WestBobGadget2503002026-03-15
4EastannGadget90010002026-04-01
5NorthCaraWidget1201002026-04-20
6WestAnnWidget7006502026-05-05
7EastBobWidget3004002026-05-09
8SouthCaraGizmo*4504502026-03-28
9EastDevGadget12009002026-06-01

The lowercase “ann” in row 4 and the asterisk in “Gizmo*” (row 8) are there on purpose. Both trip up COUNTIF.

Decision table

What you need to countCOUNTIFCOUNTIFSSUMPRODUCT
One condition✅ Best✅✅
Several conditions, all must be true (AND)❌✅ Best✅
OR within one column (East or West)⚠️ Add two COUNTIFs⚠️ SUM + array constant✅
OR across different columns (East or Widget)❌ Double counts❌✅ Best
Compare two columns row by row (Amount > Target)❌❌✅ Only option*
Condition on a function result (MONTH = 3)❌⚠️ Use a date range instead✅
Case-sensitive match❌❌✅ With EXACT
Wildcards (*, ?)✅✅❌ Use SEARCH
Reads cells in a closed workbook❌ #VALUE!❌ #VALUE!Not verified
Speed on large rangesFastFastSlower; avoid full columns

*In Excel 365, =SUM(--(D2:D9>E2:E9)) also works without SUMPRODUCT, because dynamic arrays evaluate the comparison natively.

COUNTIF: one condition

=COUNTIF(A2:A9,"East")

Returns 4. A few criteria patterns cover most needs:

CriteriaMeaningExample
"East"Equals (not case-sensitive)=COUNTIF(A2:A9,"East") → 4
">500"Comparison=COUNTIF(D2:D9,">500") → 4
">"&H1Comparison with a cellvalue in H1
"<>East"Not equal→ 4
"G*"Starts with G=COUNTIF(C2:C9,"G*") → 4
"Gizmo~*"A literal asterisk→ 1

Note the "G*" result: it counts three Gadgets and “Gizmo*”. Microsoft’s documentation explains that ? and * are wildcards in COUNTIF criteria and a tilde (~) in front makes them literal.

OR in the same column: COUNTIF has one condition, so add two:

=COUNTIF(A2:A9,"East")+COUNTIF(A2:A9,"West")

Returns 6. A shorter version with an array constant:

=SUM(COUNTIF(A2:A9,{"East","West"}))

COUNTIFS: all conditions must be true

=COUNTIFS(A2:A9,"East",D2:D9,">500")

Returns 3 (600, 900 and 1200). Microsoft documents up to 127 range/criteria pairs, and each range must have the same number of rows and columns as the first one. Otherwise you get #VALUE!.

Between two values (same column twice):

=COUNTIFS(D2:D9,">=300",D2:D9,"<=700")

Dates in a month: don’t try to test MONTH(). Give COUNTIFS a start and an end date:

=COUNTIFS(F2:F9,">="&DATE(2026,3,1),F2:F9,"<"&DATE(2026,4,1))

Returns 3 (March 2, 15 and 28). Using < the first day of the next month avoids the classic end-of-month bug where <=March 31 misses timestamps later that day.

Blank criteria trap: Microsoft’s documentation says that if a criteria argument points to an empty cell, COUNTIFS treats it as 0. A dashboard with an empty “Region” filter cell doesn’t mean “all regions”. It means “Region equals 0”, which usually counts nothing. Handle it explicitly:

=IF(H1="",COUNTIFS(D2:D9,">500"),COUNTIFS(A2:A9,H1,D2:D9,">500"))

Or use a wildcard so an empty H1 matches any text: =COUNTIFS(A2:A9,H1&"*",D2:D9,">500"). Be careful with this one: “East” would then also match “Eastern”.

SUMPRODUCT: anything you can express as TRUE/FALSE

SUMPRODUCT multiplies arrays and adds the results. Microsoft’s documentation notes that it treats non-numeric entries as zero. That matters, because a comparison returns TRUE/FALSE, not 1/0. The double minus (--) converts TRUE/FALSE to 1/0 so they’re counted:

=SUMPRODUCT(--(A2:A9="East"))

In Excel, use -- to coerce the Boolean array. Sheets returned 4 even without it in the live check; keeping the coercion makes the intent portable. Here’s what SUMPRODUCT can do that the COUNTIF family can’t.

OR across different columns

Count orders that are East or Widget:

=SUMPRODUCT(--(((A2:A9="East")+(C2:C9="Widget"))>0))

Returns 6. The tempting shortcut =SUMPRODUCT((A2:A9="East")+(C2:C9="Widget")) returns 8, because rows 2 and 7 are both East and Widget and get counted twice. The >0 turns any row with at least one match into a single 1. The same mistake happens with COUNTIF(...)+COUNTIF(...) across two columns.

Compare two columns row by row

=SUMPRODUCT(--(D2:D9>E2:E9))

Returns 4. COUNTIFS can’t do this because its criteria is a single value, not a per-row comparison.

Conditions on a calculated value

=SUMPRODUCT(--(MONTH(F2:F9)=3))

Returns 3. Watch out: an empty cell is treated as 0, and in Excel MONTH(0) returns 1, so blank rows get counted as January. Add *(F2:F9<>"") if your range has blanks.

Case-sensitive counts

COUNTIF treats “Ann” and “ann” the same. =COUNTIF(B2:B9,"ann") returns 3. For a case-sensitive count:

=SUMPRODUCT(--EXACT(B2:B9,"ann"))

Returns 1.

“Contains” without wildcards

SUMPRODUCT compares with =, so "*dg*" would look for literal asterisks. Use SEARCH (not case-sensitive) or FIND (case-sensitive):

=SUMPRODUCT(--ISNUMBER(SEARCH("dg",C2:C9)))

Returns 7 (every Widget and Gadget).

Count and sum in one go

SUMPRODUCT also sums. East Widget revenue:

=SUMPRODUCT((A2:A9="East")*(C2:C9="Widget")*D2:D9)

Returns 900. Multiplying the conditions converts TRUE/FALSE to numbers, so -- isn’t needed here.

Edge cases that give wrong counts

  1. Strings longer than 255 characters. Microsoft states COUNTIF returns incorrect results for strings over 255 characters, and suggests splitting the criteria with &. =SUMPRODUCT(--(A2:A9=H1)) has no such limit.
  2. Hidden spaces and non-breaking spaces. “East ” doesn’t equal “East” in any of the three. Microsoft’s COUNTIF best practices warn about leading or trailing spaces and nonprinting characters. If counts are too low, see TRIM not working (CHAR 160).
  3. Numbers vs. numbers stored as text. Whether COUNTIF(range,1001) also counts a text “1001” depends on the app. In LibreOffice it counted only the number with a numeric criterion, but both with the text criterion "1001". SUMPRODUCT(--(range=1001)) counted only the real number. To be safe, convert the column first (convert numbers stored as text).
  4. Long numeric IDs (16+ digits). IDs such as card or tracking numbers stored as text may be read as numbers by COUNTIF and compared using Excel’s 15-digit precision, so different IDs can look like duplicates. Mac Excel counted the two distinct text IDs as 2; Sheets returned 1 and did not reproduce that collision. If you see it, use =SUMPRODUCT(--(A2:A100=A2)), which compares the text exactly.
  5. Closed workbooks. Microsoft documents that COUNTIF returns #VALUE! when it refers to a range in another workbook that is closed. Open the source file, or bring the data into the same workbook.
  6. Full-column references in SUMPRODUCT. Microsoft warns that SUMPRODUCT(A:A,B:B) processes all 1,048,576 rows of each column. Use bounded ranges or an Excel Table (Orders[Amount]).
  7. Unique counts. =SUMPRODUCT(1/COUNTIF(B2:B9,B2:B9)) returns 4 here because COUNTIF ignores case (“Ann” and “ann” are one rep). A blank cell in the range causes #DIV/0!. In Excel 365, =ROWS(UNIQUE(B2:B9)) is easier to read. It returned 4 on the tested Mac, merging Ann/ann; Sheets UNIQUE returned 5, keeping them separate.

Excel vs. Google Sheets

  • COUNTIF, COUNTIFS and SUMPRODUCT use the same syntax. Google’s COUNTIFS page also requires all ranges to be the same size.
  • =SUM(COUNTIF(A2:A9,{"East","West"})) may return only the first count in Google Sheets unless you wrap it: =ARRAYFORMULA(SUM(COUNTIF(A2:A9,{"East","West"}))).
  • SUMPRODUCT handles arrays natively in both, so the SUMPRODUCT formulas need no ARRAYFORMULA.
  • Some Sheets locales use \ instead of , to separate columns in array constants.

Common mistakes

  1. Omitting explicit Boolean coercion in Excel SUMPRODUCT. Use -- or multiplication; Sheets counted the comparison without -- in the live check, so do not assume identical behavior across apps.
  2. Adding COUNTIFs across two columns for OR. Rows matching both get counted twice. Use the >0 SUMPRODUCT pattern.
  3. Writing "> H1" instead of ">"&H1. Inside quotes, H1 is just text. Join the operator and the cell with &.
  4. Mixing range sizes. COUNTIFS(A2:A9,"East",D2:D10,">500") and SUMPRODUCT(A2:A9,D2:D10) both return #VALUE!.
  5. Assuming an empty filter cell means “everything”. COUNTIFS treats an empty criteria cell as 0.

FAQ

What is the difference between COUNTIF and COUNTIFS?

COUNTIF takes one range and one condition. COUNTIFS takes up to 127 range/condition pairs and counts only the rows where all of them are true.

Can COUNTIFS do OR logic?

Not across different columns. For OR within one column, use =SUM(COUNTIFS(A2:A9,{“East”,“West”})). For OR across columns, use SUMPRODUCT with a >0 test so rows aren’t counted twice.

Why does my SUMPRODUCT return 0?

In Excel, an uncoerced TRUE/FALSE array can be treated as non-numeric. Sheets counted the tested comparison directly. For portable intent, add a double minus: =SUMPRODUCT(—(A2:A9=“East”)), or multiply the conditions together.

Is SUMPRODUCT slower than COUNTIFS?

It does more work per cell and can’t skip unused rows, and Microsoft advises against full-column references in SUMPRODUCT. Use COUNTIFS when it can express the condition, and keep SUMPRODUCT ranges bounded.

Is COUNTIF case-sensitive?

No. “ann” and “Ann” count as the same. Use =SUMPRODUCT(—EXACT(B2:B9,“ann”)) for a case-sensitive count.

Live-test findings

On the tested Mac, MONTH of an empty cell returned 1; Sheets returned 12. Always exclude empty cells explicitly. Sheets SUMPRODUCT of the tested Boolean comparison returned 4 even without --. Sheets COUNTIF with numeric or text criterion 1001 counted both representations (2). For OR arrays, Sheets returned 4 without ARRAYFORMULA and 6 with it; this COUNTIF behavior must not be generalized to SUMIFS.

Sources

Oscar

스프레드시트 수식과 오류 해결을 소개합니다. 검증 환경과 미확인 사항은 각 글을 참고하세요.

Tested in Microsoft Excel 16.114.4 for Mac (English UI; system region zh-Hans_US), November 8, 2026; Google Sheets (spreadsheet locale zh_CN), November 9, 2026.

다음 글: 조회 및 조건부 합계 값이 있는데 XLOOKUP이 #N/A를 반환할 때: 7가지 해결 방법