Why doesn't COUNTIFS work with array constants in the formula, when it works with references with the spilled range operator?

Sigve Berge Hofland 40 Reputation points
2026-08-04T08:08:26.5733333+00:00
  1. If ={1;1;2} is entered into A1 and ={1;2} into B1, this formula =COUNTIFS(A1#, B1#) returns an array of the same dimension as the criteria range (the value {2;1}).
  2. But if the array constants are entered directly into the formula, there is an error message that there is a problem with the formula syntax: =COUNTIFS({1;1;2}, {1;2})
  3. This formula returns an array with the dimension of range of #VALUE! errors: =LET(range, {1;1;2}, criteria, {1;2}, COUNTIFS(range, criteria)) (returns the value {#VALUE!;#VALUE!;#VALUE!})
  4. And this formula returns a #CALC! error: =LET(range, {1;1;2}, criteria, {1;2}, MAP(criteria; LAMBDA(x; COUNTIFS(range, x)))

Why doesn't 2, 3, or 4 work when 1 does?

Microsoft 365 and Office | Excel | For home | Windows
0 comments No comments

Answer accepted by question author
riny 21,430 Reputation points Volunteer Moderator
2026-08-04T08:31:23.6266667+00:00

@Sigve Berge Hofland

The first argument in COUNTIF must be a regular or spilled worksheet range. A1:A3 or A1# will both work.

But an array constant like {1;2;3} returns an 'in memory array' rather then a worksheet range (regular or spilled).

Edit: No intent to copy Rory's answer. Didn't see it until after I posted mine.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

Answer accepted by question author
Rory Archibald 19,045 Reputation points Volunteer Moderator
2026-08-04T08:28:55.51+00:00

It's how they were programmed. All of the xxxIF/xxxIFS functions require actual worksheet ranges for everything except the criteria. That's also why they don't work when the source file(s) are not open.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.