I want to get a formula with COUNTIFS
, like
=COUNTIF(A1:A3,"<>"&"")
such that when A1
= 2, A2
= "", A3
= empty, it returns 1.
Notes:
A2
contains an empty string, as the result of a formula.A3
is a blank cell, with no formulas in it.- The formula posted returns 2.
- I tried using various numbers of double quotes. I always get 2.
- I tried using
&CHAR(34)&CHAR(34)
. I get 2. - The solution posted in How do I get countifs to select all non-blank cells in Excel? is what I tried, it returns 2 (not useful).
- The formula would actually be
=COUNTIFS(range1,cond1,range2,cond2)
, that is why I cannot use something like=ROWS(A1:A3)-COUNTIF(A1:A3,"")
or=ROWS(A1:A3)-COUNTBLANK(A1:A3)
(see this).range1
andrange2
would come from expressions withINDIRECT
, but that is probably not relevant. - I have worked it out with
=SUMPRODUCT(--(expression1),--(ISNUMBER(A1:A3)))
, but I am specifically asking about the possibility of usingCOUNTIFS
. Discrimination of number vs. text (e.g.) is not relevant at this point. - Blank vs. Empty string is the source of "troubles" (see, e.g., this).
- Excel itself is somewhat ambiguous with respect to the definition of BLANK. In my example,
ISBLANK(A2)
returnsFALSE
, butCOUNTBLANK(A2)
returns1
. - I am not interested in a user
Function
.