Forum Discussion

Jessica Somers's avatar
Jessica Somers
Copper Contributor
Mar 22, 2018

Countif function

=COUNTIFS(D3,F3,H3,J3,L3,N3,P3,">0") 

Tried writing this formula but it will calculate as 0 and not count the individual cells listed if their number is greater than 0.

 

My cells are specific (exactly the ones listed above) and not in a continuous range (i.e. A1:A7).

 

How can I get this formula to count a cell if the value in the cell is greater than 0?

 

Help Please!

  • Hi Jessica,

     

    COUNTIFS will not work in this case!

    You should use this formula instead:

    =(D3>0)+(F3>0)+(H3>0)+(J3>0)+(L3>0)+(N3>0)+(P3>0)

     

    Hope that helps

  • Jamil's avatar
    Jamil
    Bronze Contributor

    Hi Jessica,

    A simple short formula like this will do the job.  INDIRECT function is volatile. if you have many cells with INDIRECT function in it. it will slow down the workbook.

     

    Frequency Function is very useful.

     

    =INDEX(FREQUENCY((D3,F3,H3,J3,L3,N3,P3),0),2)

     

  • Damien_Rosario's avatar
    Damien_Rosario
    Silver Contributor

    Hi Jessica

     

    There's a many solutions floating about online about capturing non-continguous cells, so I've pulled this formula for you which should do the trick:

     

    =SUM(COUNTIF(INDIRECT({"D3","F3","H3","J3","L3","N3","P3"}),">0"))

     

    I've also attached a sample file that I have mocked up.

     

    Let us know how you go?

     

    Cheers

    Damien

  • Haytham Amairah's avatar
    Haytham Amairah
    Silver Contributor

    Hi Jessica,

     

    COUNTIFS will not work in this case!

    You should use this formula instead:

    =(D3>0)+(F3>0)+(H3>0)+(J3>0)+(L3>0)+(N3>0)+(P3>0)

     

    Hope that helps

    • Jessica Somers's avatar
      Jessica Somers
      Copper Contributor

      This worked best for me and it was simple enough that I was able to adjust the formula to other calculations needed for those same cells.

       

      Thank you very much!

       

Resources