Share via

trying to find a countifs fomula its coming up as "0" when should be "2"

Lee Pakeman 20 Reputation points
2026-02-07T13:57:12.47+00:00

Screenshot (1)

Microsoft 365 and Office | Other
{count} votes

Answer accepted by question author
  1. IlirU 1,936 Reputation points Volunteer Moderator
    2026-02-08T14:50:18.4266667+00:00

    User's image

    Hi,

    See the screenshot above and apply formula in cell HD2:

    =BYCOL(HD1:HS1, LAMBDA(a, SUM(--(FILTER(GI2:GZ2, GI1:GZ1 = "H") & "-" & FILTER(GI2:GZ2, GI1:GZ1 = "A") = a))))

    Change the range in formula as per you need.

    Hope this helps.

    IlirU

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Marcin Policht 81,795 Reputation points MVP Volunteer Moderator
    2026-02-07T14:03:43.48+00:00

    It looks like your formula returns 0 because COUNTIFS applies AND logic to every condition, so you are asking Excel to count cells where the same position is "H" and "A" at the same time, which can never happen.

    If you want to count columns where row 3 is H or A and row 4 is 0, use two COUNTIFS and add them together:

    =COUNTIFS(E3:GZ3,"H",E4:GZ4,0)+COUNTIFS(E3:GZ3,"A",E4:GZ4,0)
    

    Or a single formula version:

    =SUMPRODUCT((E4:GZ4=0)*((E3:GZ3="H")+(E3:GZ3="A")))
    

    If it still returns 0 then your zeros may be stored as text, in which case replace 0 with "0".


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin


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.