Do not count blank cells in the COUNTIF formula.

I put together a report every week and the source data changes. Column G can get shorter or grow longer depending on each week's data, which I paste from an external CSV file.


The formula in the total row works excellently, but how can I make the formula not count blank cells?

Current Formula: COUNTIF(Server IPs,"<>0")


(see attached screenshot)



** Please note that the column's data format is Number.


Thank you,


Chad

MacBook Pro 16″, macOS 13.6

Posted on Nov 3, 2023 8:17 AM

Reply
Question marked as Top-ranking reply

Posted on Nov 3, 2023 10:58 AM

A simple =COUNTIF(G,"<>") works if the cells are blank. The "G" reference ignores headers and footers.


(edited to delete the incorrect additional info I provided. In your original formula using <>0, a blank cell is <>0 so it counted all of them)


9 replies

Nov 3, 2023 9:59 AM in response to chadb427

If you have a column formatted as Number and you just want to count the number of values in that column, you can try something as simple as this:





Note that the last row is defined as a Footer Row so you can have a formula that refers to the whole column. That way you can add new data and the formula will automatically include the new rows so you don't have to edit the range in the formula.


If you have formulas in the column that show a "blank" that you don't want to count then you can try something like this:




=COUNTIF(G,"<>"&"")


Use ; instead of , in the formula if your regions uses , as the decimal separator.


SG

Dec 8, 2023 6:32 AM in response to chadb427

chadb427 wrote:

=COUNTIF(G,"<>"&"") to count all the items in Column G, and if there is zero or no data in a cell, the formula will not count them, correct?


Recommend actually trying out the suggestions and other things.


I think you statement is almost correct.


=COUNTIF(G,"<>"&"") and COUNTA will exclude cells that don't have a value in them but will count cells that have 0 or a formula in them.


It would help if you could describe your use case.


SG




Dec 8, 2023 5:38 AM in response to chadb427

I'm just checking in and pushing this to the top of inboxes again.


I put together a report every week and the source data changes. Column G can get shorter or grow longer depending on each week's data, which I paste from an external CSV file.


The formula in the total row works excellently, but how can I make the formula not count blank cells?

Current Formula: COUNTIF(Server IPs,"<>0")

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Do not count blank cells in the COUNTIF formula.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.