Forum Discussion

DraygonTech's avatar
DraygonTech
Copper Contributor
Apr 29, 2022

COUNTIFS

If I use COUNTIF or COUNTIFS on one column, it returns 17 (correctly).

But when I try to add the second column in COUNTIFS, it returns 0 (very incorrectly).

Am I messing up the syntax?

 

=COUNTIFS(B:B, "R", H:H, "R")

 

Thanks,

Tony

2 Replies

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    DraygonTech 

    COUNTIFS returns the count of items that match ALL criteria. Thus, the number of cells that contain "R" in both columns B and H (i.e. on the same row).

    Try this one in stead:

     

    =COUNTIF(B:B,"R")+COUNTIF(H:H,"R")

    • DraygonTech's avatar
      DraygonTech
      Copper Contributor

      Riny_van_Eekelen 

      So, a +1 only occurs when the "R" exists for both Columns B and H, on each row?

      That is so weird... but makes sense why a 0 was returned, as the data sets are not on the same rows.

      Adding the COUNTIFS() together returns the expected result... but completely bypasses the entire reason I was using COUNTIFS.. might as well just add COUNTIF() statements! 😛

      Regardless, you helped me with the solution I was needing. I really appreciate it.

       

      Best,

      Tony

Resources