3

For Google Sheets, I've seen people use both =COUNTIF(range,"<>"&"") as well as =COUNTIF(range,"<>") to count the number of non-empty cells in a range.

Is there any difference, benefit, or concern, using one approach over the other?

1
  • 1
    please edit your question and provide a clear example of the formula you are using. Feb 28 at 15:48

1 Answer 1

3

TL;DR

No difference. &"" is redundant.

A.  They are equivalent

The formulas ="<>"&"" and ="<>" both return <>.

This is necessarily so because any text string, whether "<>" or "webAppsRocks", is equivalent to the result of joining nothing else to it.

B.  The reason to use "<>"&"" instead of "<>"

  1. I don't know a good reason to include &"" in any of the following:
    =COUNTIF(range,"<>&"") 
    =COUNTIF(range,"<>&""&"")
    =COUNTIF(range,"<>"&""&""&""&""&""&""&""&""&""&"")
    
  2. Including "" may reflect a lack of experience on the part of users possibly combined with a spillover effect from Microsoft Excel. Even though &"" is redundant in Excel as well, users habitually include empty strings "" in formulas to avoid returning zero values. For example:
    # Excel Formula Examples
    =IF(TRUE,) =IF(TRUE,"",) =0 =[ empty_string ]
    =IFERROR(1/0,) =IFERROR(1/0,"") =0 =[
    empty_string ]

C.  Why use COUNTIF?

If your goal is to count the number of values in a range or array, COUNTA is designed specifically to do that.

=COUNTA(range)   vs.  =COUNTIF(range,"<>")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.