Share via

Excel: Can't get =COUNTIFS to Count all Cells Containing a Value

Andy Bebbington 20 Reputation points
2026-01-29T12:57:24.9366667+00:00

Hi,

I'm trying to use the COUNTIFS to count the number of times a particular value occurs in a number of non-contiguous cells in a line. This is the syntax which I'm using:-

=COUNTIFS($B$6,"=5",$N$6,"=5",$T$6,"=5")

Rather than count the number of occurrences, it is returning a 1 if all 3 cells contain the value (5 in this case) and 0 if any of the cells don't contain the value. I would expect it to return 3 (all 3 cells contain the value), 2 (any 2 out of 3 cells contain the value) or 1 (any one out of the 3 cells contain the value).

Ultimately, I want to increase the number of cells which this function looks at and counts up how many times a value occurs. Thus, for line 6, it will look at B6, D6, F6, H6, J6, L6, N6, P6, R6, T6, V6 and X6 and tell me how many times the number 5 occurs.

Where am I going wrong?

Thanks

Andy B

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

Answer accepted by question author

  1. EmilyS726 227.5K Reputation points Independent Advisor
    2026-01-29T13:32:36.61+00:00

    COUNTIFS is doing exactly what it is designed to do: it counts rows where ALL criteria pairs are true at the same time. It cannot return 2 or 3 because COUNTIFS does not add matches across separate cells, it evaluates them together as a single record.

    You might want to use this instead

    =COUNTIF(CHOOSE({1,2,3},B6,N6,T6),5)

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Ashish Mathur 101.8K Reputation points Volunteer Moderator
    2026-01-29T23:19:59.7366667+00:00

    Hi,

    Try this formula

    =SUM(1*(CHOOSECOLS(B6:F6,SEQUENCE(,ROUNDUP(COLUMNS(B6:F6)/2,0),,2))=5))

    Hope this helps.

    User's image


  2. Andy Bebbington 20 Reputation points
    2026-01-29T15:54:15.4066667+00:00

    Hi Emily,

    Following your latest response, I tried clicking on See The Answer so that I could click on Accept but it comes up with a 404 error, not found.

    I see an Accept Answer against your first response but haven't clicked it in case this only accepts the first response rather than the whole thread. Thus, before I click there can you advise if it is correct to click that one or should there be another Accept Answer nearer to the bottom of this thread?

    Thanks


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.