Data Analysis

Excel COUNTIF Array Criteria: Return Multiple Counts

Marc SeanOctober 26, 20268 min read
=COUNTIF($C$18:$C$47,A5:A8)

The results spill through B5:B8. The first corresponds to A5, the second to A6, and so on. COUNTIF evaluates each criterion separately, so it doesn’t combine them into one OR count.

Microsoft documents the standard COUNTIF(range, criteria) syntax and explains how formulas that return multiple values populate a neighboring dynamic-array spill range.

Download the support-ticket example

The synthetic COUNTIF Array Results - Support Ticket Batch Review workbook contains a 20-ticket batch and three criteria tables.

On the Ticket Array Counts sheet, the records occupy A18:I47:

ColumnContents
ATicket ID, nonblank for each active record
BOpened date
CIssue type
DStatus
EOwner
FNumeric age in days
GPriority
HChannel
INext action

The criteria and source ranges are:

RangeContents
A5:A8Issue-type criteria
E5:E8Status criteria
I5:I8Age criteria
C18:C47Issue-type source range
D18:D47Status source range
F18:F47Numeric age source range

Populate the criteria cells with intentional values. In Excel, a reference to a genuinely empty criterion cell is treated as 0. An explicit "" criterion, or a criterion cell containing a formula that returns "", matches blank or empty-string source cells. Neither should be used as a placeholder in these criteria lists.

Literal COUNTIF array formulas above three working criteria tables with row-aligned counts, percentage shares, and exception checks.

Row 2 displays the array formulas as text. For compatibility, the working tables initially use separate COUNTIF formulas. Meanwhile, B13 flags tickets whose issue types aren’t covered by the current criteria list.

Use separate COUNTIF formulas for compatibility

The workbook begins with one formula per result cell, so the layout doesn’t depend on spill support:

B5: =COUNTIF($C$18:$C$47,A5)
B6: =COUNTIF($C$18:$C$47,A6)
B7: =COUNTIF($C$18:$C$47,A7)
B8: =COUNTIF($C$18:$C$47,A8)

The supplied batch produces:

CriterionResult cellCountShare
BillingB5525%
LoginB6420%
DeliveryB7525%
OtherB8420%

Use these formulas for the total and coverage controls:

B11: =COUNTA($A$18:$A$47)
B12: =SUM(B5:B8)
B13: =B11-B12

Every ticket in the supplied batch has a nonblank ID, so B11 returns 20. Because the listed issue types cover 18 tickets, B12 equals 18 and B13 equals 2.

Enter this share formula in C5 and fill it through C8:

=IF($B$11=0,"",B5/$B$11)

Format C5:C8 as percentages. When the batch has no ticket IDs, the IF guard returns an empty string instead of #DIV/0!.

Replace four formulas with one array formula

To use a single formula in dynamic-array Excel:

  1. Clear B5:B8.
  2. Enter this formula in B5:
=COUNTIF($C$18:$C$47,A5:A8)
  1. Keep the share formulas in C5:C8.

The formula spills through B8 and returns 5, 4, 5, and 4:

  • B5 = 5 corresponds to Billing in A5.
  • B6 = 4 corresponds to Login in A6.
  • B7 = 5 corresponds to Delivery in A7.
  • B8 = 4 corresponds to Other in A8.

You’ll find this formula displayed as text in B2 of the template. If a leading apostrophe appears when you copy it into B5, omit the apostrophe.

Apply the same pattern to statuses

Next, clear F5:F8 and enter this formula in F5:

=COUNTIF($D$18:$D$47,E5:E8)

With New, In Progress, Waiting, and Resolved in E5:E8, the expected results in F5:F8 are 5, 5, 5, and 5.

Enter this share formula in G5 and fill through G8:

=IF($B$11=0,"",F5/$B$11)

The status controls are:

F11: =SUM(F5:F7)
F12: =F8
F13: =J5

In the supplied layout:

  • F11 returns 15 active tickets across the first three statuses.
  • F12 returns 5 resolved tickets.
  • F13 returns the 7 tickets older than 7 days.

If you reorder the status or age criteria, revise the summary labels and references so they retain their stated meaning.

Count against overlapping age criteria

For the age table, clear J5:J8, then enter this formula in J5:

=COUNTIF($F$18:$F$47,I5:I8)

The results are:

CriterionResult cellCount
>7J57
>14J63
>30J70
>60J80

Enter this share formula in K5 and fill through K8:

=IF($B$11=0,"",J5/$B$11)

After you format K5:K8 as percentages, the baseline shares are 35%, 15%, 0%, and 0%.

These thresholds overlap. A ticket older than 14 days also satisfies >7, so adding the results would count that ticket twice. If you need aging buckets such as 0-7, 8-14, and 15-30 days, use nonoverlapping criteria instead.

A numeric age of zero doesn’t satisfy >7 or >14. Blank, empty-string, and other nonnumeric age values are also excluded from these numeric comparisons, so review them before making aging decisions. Because ages in F18:F47 are manual inputs, you must update them whenever the review date in F15 changes.

Synthetic support ticket batch containing varied issue types, statuses, owners, ages, priorities, channels, and next actions.

Replace the synthetic tickets with the current batch and continue through row 47. Keep each active ticket ID nonblank, and enter numeric ages, including zero for a ticket opened on the review date.

Verify the returned array

The workbook’s scalar compatibility formulas and control values were executed and verified in Google Sheets. You can use these values as comparison targets after replacing the formulas with dynamic-array formulas in Excel. However, they don’t verify spill execution in a particular Excel installation or downloaded file.

Run these checks:

  • Baseline: B5:B8 should return 5, 4, 5, and 4. Their sum is 18, leaving 2 of 20 tickets outside the listed issue types.
  • Changed criterion: Replacing Billing in A5 with Access Request should change B5:B8 to 2, 4, 5, and 4. The covered total becomes 15, while the unmatched count becomes 5.
  • Zero boundary: Changing ticket T-1001 to age zero should reduce the >7 and >14 counts from 7 and 3 to 6 and 2. The other age results remain zero.
  • No match: A nonblank issue criterion absent from C18:C47 should return zero in its corresponding result position.

If you want the original control values back, restore the baseline inputs after each independent check.

Fix common COUNTIF array problems

Excel shows #SPILL!

In this template, the original scalar formulas may obstruct the intended spill range. If the array formula is in B5, retain it and clear only B6:B8.

Apply the same template-specific fix elsewhere:

  • Formula in F5: clear F6:F8.
  • Formula in J5: clear J6:J8.

Don’t clear the adjacent share columns C, G, or K.

Occupied cells aren’t the only possible cause. Microsoft also identifies merged cells, formulas inside Excel tables, indeterminate array sizes, and results extending past the worksheet boundary as possible #SPILL! causes.

A count appears beside the wrong label

Sorting or changing A5:A8 normally makes the array formula recalculate in the new order. You also can’t normally edit spill-result cells separately.

Apparent misalignment may indicate that:

  • The formula references the wrong criteria range.
  • Labels were moved separately from their table.
  • The counts were pasted as static values.
  • Separate scalar formulas use inconsistent row references.

For the issue table, confirm that B5 contains =COUNTIF($C$18:$C$47,A5:A8) and its spill occupies B5:B8 beside A5:A8.

The categorized total is too high

First, check for duplicate criteria. If Billing appears twice in A5:A8, COUNTIF returns the Billing count twice. Each row-level result is correct, but SUM(B5:B8) is no longer a valid coverage check.

Then inspect the criteria cells:

  • A genuinely empty referenced cell is treated as 0 by COUNTIF.
  • A literal numeric 0 intentionally counts values that meet zero criteria.
  • An explicit "", or a formula-produced empty string, counts blank or empty-string source cells.

For the issue and status coverage tables, use unique, nonblank text criteria.

The unmatched count is positive

A positive B13 means the listed issue counts don’t cover every ticket ID counted in B11. Review C18:C47 for omitted issue types, inconsistent spelling, or leading and trailing spaces.

This control identifies uncovered values, but it doesn’t prove that every covered issue type was entered correctly.

Excel rejects the formula separator

These formulas use commas between arguments. Some Excel regional settings require semicolons:

=COUNTIF($C$18:$C$47;A5:A8)

Keep comparison criteria such as >7 unchanged.

For the corresponding Google Sheets method, see ARRAYFORMULA COUNTIF in Google Sheets.

Review the formulas with ModelMonkey

ModelMonkey can inspect spreadsheet context in Excel or Google Sheets and help analyze or adjust formulas and cell content. For this workbook, you could ask:

Inspect the criteria lists and COUNTIF formulas on Ticket Array Counts. Check that each formula uses the intended source range, returns results beside the matching criteria, and preserves the percentage-share controls.

Review any proposed formulas and the resulting controls, especially when the criteria overlap. Use ModelMonkey to review this COUNTIF array setup.

Frequently Asked Questions