Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / October 2006

Tip: Looking for answers? Try searching our database.

Using COUNTIF to search for existence

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Epinn - 18 Oct 2006 23:04 GMT
I want to use COUNTIF > 0 to determine if a value in column A exists in another column.  This works fine for non-blank and non-zero cells.  COUNTIF appears to handle a blank and a "0" the same way.  If they exist in column A and a blank exists in another column, FALSE will be returned for both "0" and blank.  If a "0" exists in another column, TRUE will be returned for both "0" and blank.  Wonder how I can differentiate between the two.  If I have a blank in column A and a "0" in another column, I don't want to consider it a match.  Guess I have to use COUNTBLANK on the two columns respectively.

Any comments?

Epinn  
Bob Phillips - 18 Oct 2006 23:50 GMT
You are not making sense (at least to me). What does another column have to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.  COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in column A
and a blank exists in another column, FALSE will be returned for both "0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn
Epinn - 19 Oct 2006 00:34 GMT
Should have included my formula instead of writing lines.  Although I say column, I use each cell in the column as a criterion.  The formula is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.  COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in column A
and a blank exists in another column, FALSE will be returned for both "0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn
Epinn - 19 Oct 2006 00:42 GMT
I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Should have included my formula instead of writing lines.  Although I say column, I use each cell in the column as a criterion.  The formula is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

"Bob Phillips" <bob.NGs@somewhere.com> wrote in message news:#e9w6fw8GHA.3396@TK2MSFTNGP04.phx.gbl...
You are not making sense (at least to me). What does another column have to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u5KsSGw8GHA.3820@TK2MSFTNGP02.phx.gbl...
I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.  COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in column A
and a blank exists in another column, FALSE will be returned for both "0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn

Epinn - 19 Oct 2006 00:58 GMT
>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message news:u42GA4w8GHA.3264@TK2MSFTNGP04.phx.gbl...
Should have included my formula instead of writing lines.  Although I say column, I use each cell in the column as a criterion.  The formula is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

"Bob Phillips" <bob.NGs@somewhere.com> wrote in message news:#e9w6fw8GHA.3396@TK2MSFTNGP04.phx.gbl...
You are not making sense (at least to me). What does another column have to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u5KsSGw8GHA.3820@TK2MSFTNGP02.phx.gbl...
I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.  COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in column A
and a blank exists in another column, FALSE will be returned for both "0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn

Alan Beban - 19 Oct 2006 09:02 GMT
If the functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your workbook, you might
want to see if ArrayCountIf, rather than COUNTIF, gives you the results
you seek.

Alan Beban

>>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>>   COUNTIF(C:G,A1)>0
[quoted text clipped - 31 lines]
>
> =COUNTIF(A:A,"") counts blanks for me.
Roger Govier - 19 Oct 2006 09:08 GMT
Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:#GnoC8w8GHA.4740@TK2MSFTNGP02.phx.gbl...
I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u42GA4w8GHA.3264@TK2MSFTNGP04.phx.gbl...
Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u5KsSGw8GHA.3820@TK2MSFTNGP02.phx.gbl...
I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn

Epinn - 19 Oct 2006 09:35 GMT
Hello Roger,

I am "intrigued" and I will experiment in detail much later today.

Let me quickly tell you what I just did.  I started a blank sheet.  I did =COUNTBLANK(A1:A10) and I got 10.  Then I keyed in = " " to A1 and A2 respectively, and I got 8.  Then I keyed in 999 into A3 and I got 7.  Then I cleared A3 and I got 8.  I have always wondered if Excel can tell a blank cell (never touched) from a cell that has data previously but cleared.  This test tells me "no" but one expert says it can.  Is my test not set up properly or have I misunderstood the expert or ......

Can you or someone tell me if Excel knows the difference between a blank cell and a cleared cell?  I am pretty sure now that Excel can differentiate between a null cell and a blank cell.

Epinn (getting too detailed?)

Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn
Epinn - 19 Oct 2006 10:18 GMT
I better clarify before anyone "flames" at me.  In my test, I had a space between the quotes i.e. " " and I shouldn't have.

>>> For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0. <<<

I know why.  I did evaluate formula and H1 (a blank cell) shows 0.  

Hello Roger,

I am "intrigued" and I will experiment in detail much later today.

Let me quickly tell you what I just did.  I started a blank sheet.  I did =COUNTBLANK(A1:A10) and I got 10.  Then I keyed in = " " to A1 and A2 respectively, and I got 8.  Then I keyed in 999 into A3 and I got 7.  Then I cleared A3 and I got 8.  I have always wondered if Excel can tell a blank cell (never touched) from a cell that has data previously but cleared.  This test tells me "no" but one expert says it can.  Is my test not set up properly or have I misunderstood the expert or ......

Can you or someone tell me if Excel knows the difference between a blank cell and a cleared cell?  I am pretty sure now that Excel can differentiate between a null cell and a blank cell.

Epinn (getting too detailed?)

"Roger Govier" <roger@technologyNOSPAM4u.co.uk> wrote in message news:u5N#UX18GHA.2120@TK2MSFTNGP03.phx.gbl...
Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:OQF8NFx8GHA.3644@TK2MSFTNGP03.phx.gbl...

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:#GnoC8w8GHA.4740@TK2MSFTNGP02.phx.gbl...
I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u42GA4w8GHA.3264@TK2MSFTNGP04.phx.gbl...
Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u5KsSGw8GHA.3820@TK2MSFTNGP02.phx.gbl...
I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn

Epinn - 19 Oct 2006 09:45 GMT
It is not difficult to differentiate between the pair (0 and blank) and null.  The problem is to differentiate between 0 and blank.  

As stated in my previous posts, I couldn't get TRUE when there was a match for a blank cell.  If a zero was found, I got TRUE when in fact the criterion was a blank cell.

More later ......

Epinn

Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn
Epinn - 20 Oct 2006 02:57 GMT
Hi Roger,

Thank you for taking the time to get to the bottom.  I did your test and it confirmed my prepost test on blank and zero.  The fact that you brought up null string (i.e. empty text) and Lori mentioned true blank (i.e. ignoring null string) help me see the big picture.

>> I may be entirely wrong here...... <<

No, you are absolutely correct based on our tests that there are three conditions:-

0, blank and null

and may be there is a fourth condition - true blank??

I find it interesting that blanks have such affinity.

Blanks team up with 0 and are apart from null strings - see Roger's test.
Blanks team up with null strings - COUNTBLANK.
Blanks are true blanks and apart from null strings - COUNTIF with "=" as criterion.

Have I left out anything?

Epinn

Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn
Epinn - 20 Oct 2006 08:52 GMT
Forgot to discuss about ISBLANK which is equivalent to COUNTIF with criterion "=" > 0.

ISBLANK returns TRUE for a blank and FALSE for a null string.  It is different from COUNTBLANK.

Hi Roger,

Thank you for taking the time to get to the bottom.  I did your test and it confirmed my prepost test on blank and zero.  The fact that you brought up null string (i.e. empty text) and Lori mentioned true blank (i.e. ignoring null string) help me see the big picture.

>> I may be entirely wrong here...... <<

No, you are absolutely correct based on our tests that there are three conditions:-

0, blank and null

and may be there is a fourth condition - true blank??

I find it interesting that blanks have such affinity.

Blanks team up with 0 and are apart from null strings - see Roger's test.
Blanks team up with null strings - COUNTBLANK.
Blanks are true blanks and apart from null strings - COUNTIF with "=" as criterion.

Have I left out anything?

Epinn

"Roger Govier" <roger@technologyNOSPAM4u.co.uk> wrote in message news:u5N#UX18GHA.2120@TK2MSFTNGP03.phx.gbl...
Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:OQF8NFx8GHA.3644@TK2MSFTNGP03.phx.gbl...

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:#GnoC8w8GHA.4740@TK2MSFTNGP02.phx.gbl...
I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u42GA4w8GHA.3264@TK2MSFTNGP04.phx.gbl...
Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u5KsSGw8GHA.3820@TK2MSFTNGP02.phx.gbl...
I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn

Epinn - 20 Oct 2006 21:15 GMT
Roger,

I should stop playing with blank, null, zero etc. real soon or I may go "insane."

Let me tell you what I have found.  Not sure if it is a bug.

Key in 1,2,3,4,5,6,7,8,9,0 to A1:A10 respectively i.e. A1 = 1, A2 = 2 etc. etc.

Then key in the following somewhere.

=SUMPRODUCT(COUNTIF(A1:A10,A1:A10))>10

You get a FALSE because there is no duplicate.  Now, change the "2" in A2 to "1".

You get a TRUE because there is duplicate i.e. A1=A2=1.  So far so good.  Please do "evaluate formula" at this time.  You will see {2,2,1,1,.....} and this makes sense.  I just want to make note of the lst and 2nd "2".

Now clear A1 and A2 by pressing del key and you have two blank cells.  You get a FALSE.  I can accept that the formula ignore two blanks.  Now the following confuses me.

You still have A1 and A2 as two empty blank cells, right?  Now, key in ="" to A1.  Do you get TRUE?  So, what is the duplicate here?  Let's do "evaluate formula" and you will see just ONE "2".  I can't explain this.  Remember earlier when we have A1 and A2 being "1" evaluate formula shows us {2,2,1,1,......}.  It doesn't make sense to me that there is only ONE "2" now.  If there is a duplicate, there should be another "2" somewhere between the { }.

Is this a bug or am I going "crazy?"  By the way, I use version 2003.  Would you mind telling me if you have got the same.  

Now, I am going to explore the following which is better to search for duplicates.

=IF(COUNTA(A1:A10),MAX(FREQUENCY(A1:A10,A1:A10))>1,"")

I appreciate your help.

Epinn  

Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn
Alan Beban - 20 Oct 2006 22:24 GMT
> . . . .  Now, key in ="" to A1.  Do you get TRUE?  . . .

No. I get FALSE.

Alan Beban
Epinn - 21 Oct 2006 00:16 GMT
Alan,

Which version do you use?  When you got FALSE did you do evaluate formula?  Probably no point.

I am sorry I have to ask questions, because I have tried so many times and I know what I am doing and I have got TRUE.  Don't know if it is temperamental.  I am sure I am not seeing things.

You do key in ="" i.e. a equal sign, shift+double quotes twice, right?  No space between the quotes.

The thing is I didn't just get TRUE.  The "evaluate formula" showed me something that I had a hard time accepting.

By the way, thanks for the link and I shall check if I haven't gone "crazy" after this thread.  ;)

Epinn

Epinn wrote:
> . . . .  Now, key in ="" to A1.  Do you get TRUE?  . . .

No. I get FALSE.

Alan Beban
Alan Beban - 21 Oct 2006 06:51 GMT
> Alan,
>
> Which version do you use?  When you got FALSE did you do evaluate formula?  Probably no point.

My bad! I had 10 in Cell A10 rather than 0.  I get TRUE (xl2002)

With the empty string in A1 and A2 blank, the formula sees two empty
strings (A1 and A2) but only 1 blank (A2).  If you change the empty
string in A1 to a 0, it sees 2 0's (A1 and A10) and 2 blanks (A2 and ?).
If you then change the blank in A2 to an empty string it sees 2 0's (A1
and A10) and 1 empty string (A2).

Alan Beban

> I am sorry I have to ask questions, because I have tried so many times and I know what I am doing and I have got TRUE.  Don't know if it is temperamental.  I am sure I am not seeing things.
>
[quoted text clipped - 12 lines]
>
> Alan Beban
Alan Beban - 21 Oct 2006 07:05 GMT
As I suggested previously, the ArrayCountIf function in the freely
downloadable file at http://home.pacbell.net/beban seems to evaluate
0's, blanks and empty strings separately. I had to use
ArrayCountIf(A$1:A$10,A1) and copy down, however, because the function
doesn't currently accept multiple sought values, which is what it
considers the array formula as involving.

Alan Beban

>> Alan,
>>
[quoted text clipped - 32 lines]
>>
>> Alan Beban
Sandy Mann - 20 Oct 2006 22:50 GMT
Epinn,

Just to muddy the waters try this:

in a1 enter ="" and leave A2:A10 empty

now highlight B1+B10 and enter:

=COUNTIF(A1:A10,A1:A10)

and complete it by array entering the formula(s) with Ctrl + Shift + Enter

I get:

10
0
0
0
0
0
0
0
0
0

Therefore to Excel   "" = Blank but Blank <> ""

Go figure!

Signature

HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

sandymann2@mailinator.com
Replace@mailinator.com with @tiscali.co.uk

Roger,

I should stop playing with blank, null, zero etc. real soon or I may go
"insane."

Let me tell you what I have found.  Not sure if it is a bug.

Key in 1,2,3,4,5,6,7,8,9,0 to A1:A10 respectively i.e. A1 = 1, A2 = 2 etc.
etc.

Then key in the following somewhere.

=SUMPRODUCT(COUNTIF(A1:A10,A1:A10))>10

You get a FALSE because there is no duplicate.  Now, change the "2" in A2 to
"1".

You get a TRUE because there is duplicate i.e. A1=A2=1.  So far so good.
Please do "evaluate formula" at this time.  You will see {2,2,1,1,.....} and
this makes sense.  I just want to make note of the lst and 2nd "2".

Now clear A1 and A2 by pressing del key and you have two blank cells.  You
get a FALSE.  I can accept that the formula ignore two blanks.  Now the
following confuses me.

You still have A1 and A2 as two empty blank cells, right?  Now, key in =""
to A1.  Do you get TRUE?  So, what is the duplicate here?  Let's do
"evaluate formula" and you will see just ONE "2".  I can't explain this.
Remember earlier when we have A1 and A2 being "1" evaluate formula shows us
{2,2,1,1,......}.  It doesn't make sense to me that there is only ONE "2"
now.  If there is a duplicate, there should be another "2" somewhere between
the { }.

Is this a bug or am I going "crazy?"  By the way, I use version 2003.  Would
you mind telling me if you have got the same.

Now, I am going to explore the following which is better to search for
duplicates.

=IF(COUNTA(A1:A10),MAX(FREQUENCY(A1:A10,A1:A10))>1,"")

I appreciate your help.

Epinn

Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:OQF8NFx8GHA.3644@TK2MSFTNGP03.phx.gbl...

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:#GnoC8w8GHA.4740@TK2MSFTNGP02.phx.gbl...
I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u42GA4w8GHA.3264@TK2MSFTNGP04.phx.gbl...
Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u5KsSGw8GHA.3820@TK2MSFTNGP02.phx.gbl...
I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn

Epinn - 21 Oct 2006 00:43 GMT
Sandy,

Before I forget, did you get FALSE or TRUE with *my* experiment?  Alan got FALSE and I got TRUE.  Please tell me what you have got and what version, please.

You have an interesting test there and I am glad that I am not seeing things.  However, I am totally lost and on the verge of going ......  You know, Roger and I spent some time doing tests to come to an agreement that blank is equivalent to 0 when we use COUNTIF and A1 (a blank cell) as criterion.  Now your test which says

"" = Blank but Blank <> ""

may have complicated our "understanding."  Of course, you are not to blame.  

One thing I am quite sure though - BLANK doesn't have a backbone and can have great affinity depending on its mood.  

My dear Excel, do you have any idea what I am going through?  Any MS Excel developer(s) reading this?    

Epinn

Epinn,

Just to muddy the waters try this:

in a1 enter ="" and leave A2:A10 empty

now highlight B1+B10 and enter:

=COUNTIF(A1:A10,A1:A10)

and complete it by array entering the formula(s) with Ctrl + Shift + Enter

I get:

10
0
0
0
0
0
0
0
0
0

Therefore to Excel   "" = Blank but Blank <> ""

Go figure!

Signature

HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

sandymann2@mailinator.com
Replace@mailinator.com with @tiscali.co.uk

Roger,

I should stop playing with blank, null, zero etc. real soon or I may go
"insane."

Let me tell you what I have found.  Not sure if it is a bug.

Key in 1,2,3,4,5,6,7,8,9,0 to A1:A10 respectively i.e. A1 = 1, A2 = 2 etc.
etc.

Then key in the following somewhere.

=SUMPRODUCT(COUNTIF(A1:A10,A1:A10))>10

You get a FALSE because there is no duplicate.  Now, change the "2" in A2 to
"1".

You get a TRUE because there is duplicate i.e. A1=A2=1.  So far so good.
Please do "evaluate formula" at this time.  You will see {2,2,1,1,.....} and
this makes sense.  I just want to make note of the lst and 2nd "2".

Now clear A1 and A2 by pressing del key and you have two blank cells.  You
get a FALSE.  I can accept that the formula ignore two blanks.  Now the
following confuses me.

You still have A1 and A2 as two empty blank cells, right?  Now, key in =""
to A1.  Do you get TRUE?  So, what is the duplicate here?  Let's do
"evaluate formula" and you will see just ONE "2".  I can't explain this.
Remember earlier when we have A1 and A2 being "1" evaluate formula shows us
{2,2,1,1,......}.  It doesn't make sense to me that there is only ONE "2"
now.  If there is a duplicate, there should be another "2" somewhere between
the { }.

Is this a bug or am I going "crazy?"  By the way, I use version 2003.  Would
you mind telling me if you have got the same.

Now, I am going to explore the following which is better to search for
duplicates.

=IF(COUNTA(A1:A10),MAX(FREQUENCY(A1:A10,A1:A10))>1,"")

I appreciate your help.

Epinn

Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn
Pete_UK - 21 Oct 2006 12:58 GMT
Epinn,

I'm not sure how far you want to go with this investigation, but it
strikes me that there are some other "blanks" that you have not
reported on:

Some people will clear the contents of a cell by pressing the space
bar. The cell looks empty, as does the formula bar, and even in edit
mode it is difficult to "see" the space, so a normal user might
consider these cells to be "blank". Obviously, multiple spaces will
have the same effect.

The non-breaking space character, 160, will have the same appearance,
as will combinations of this with "normal" space characters.

If you have formulae which return a null string, "", and then fix the
values using paste special, Excel will leave a single apostrophe in the
cell, which will look empty. Obviously, this could also occur with
spaces and nb spaces after it.

Some character codes (eg 10) do not give rise to printable characters,
and you may have some of these in cells which make them seem blank.

All of these will appear empty, but clearly are not. You might want to
look into ways of handling these situations.

Pete

> Sandy,
>
[quoted text clipped - 205 lines]
>
> Epinn
Roger Govier - 21 Oct 2006 13:14 GMT
Hi Epinn

Whilst I predominantly use Excel 2003, I have Excel 97, 2000, 2002 and
2003 loaded on my machine for working with and testing different
client's data against workbooks I have created for them with both
functions and VBA.

I have loaded each version and tested the following and I can discern no
difference in the behaviour between all versions with respect to the
various tests.

Sandy's assertion
"" = Blank but Blank <> ""
is true in the way that COUNTIF works.

I set up the following in cells A1:D9
(I am using words here to describe what was included in cells A1:B9 and
actual results for C1:D9)

     Blank Blank TRUE 3
     Blank Null TRUE 3
     Null Blank TRUE 6
     Null Null TRUE 6
     Blank Zero TRUE 3
     Zero Blank TRUE 3
     Zero Zero TRUE 3
     Zero Null FALSE 3
     Null Zero FALSE 6

In cell C1 I have the formula =A1=B1  copied down through C2:C9
In cell D1 I have the formula =COUNTIF($A$1:$A$9,A1)   copied down
through D2:D9

(Using Sandy's array entered formula =COUNTIF(A1:A9,A1:A9) through cells
E1:E9 produces identical counts so has not been included in the table
above)

In the logic tests for the 9 possible comparisons of Zero, Blank and
Null we see that all comparisons are True other than Zero compared with
Null.

Countif, however, correctly counts that there are 3 Zeros in the range,
and 3 Blank's in the range.
But it counts 6 Nulls (being the 3 real Nulls' plus the 3 Blank's)

So Countif when starting with Blank as the comparative, ignores Nulls
and treats them as Not equal to Blank
When starting with Null as the comparative, it treats Blank as being
equal to Null and includes them.

So Boolean logic says Blank equals Null and Null equals Blank, but
Countif doesn't agree.
Very strange!!!

Signature

Regards

Roger Govier

Sandy,

Before I forget, did you get FALSE or TRUE with *my* experiment?  Alan
got FALSE and I got TRUE.  Please tell me what you have got and what
version, please.

You have an interesting test there and I am glad that I am not seeing
things.  However, I am totally lost and on the verge of going ......
You know, Roger and I spent some time doing tests to come to an
agreement that blank is equivalent to 0 when we use COUNTIF and A1 (a
blank cell) as criterion.  Now your test which says

"" = Blank but Blank <> ""

may have complicated our "understanding."  Of course, you are not to
blame.

One thing I am quite sure though - BLANK doesn't have a backbone and can
have great affinity depending on its mood.

My dear Excel, do you have any idea what I am going through?  Any MS
Excel developer(s) reading this?

Epinn

Epinn,

Just to muddy the waters try this:

in a1 enter ="" and leave A2:A10 empty

now highlight B1+B10 and enter:

=COUNTIF(A1:A10,A1:A10)

and complete it by array entering the formula(s) with Ctrl + Shift +
Enter

I get:

10
0
0
0
0
0
0
0
0
0

Therefore to Excel   "" = Blank but Blank <> ""

Go figure!

Signature

HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

sandymann2@mailinator.com
Replace@mailinator.com with @tiscali.co.uk

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:eMIAxRI9GHA.4572@TK2MSFTNGP02.phx.gbl...
Roger,

I should stop playing with blank, null, zero etc. real soon or I may go
"insane."

Let me tell you what I have found.  Not sure if it is a bug.

Key in 1,2,3,4,5,6,7,8,9,0 to A1:A10 respectively i.e. A1 = 1, A2 = 2
etc.
etc.

Then key in the following somewhere.

=SUMPRODUCT(COUNTIF(A1:A10,A1:A10))>10

You get a FALSE because there is no duplicate.  Now, change the "2" in
A2 to
"1".

You get a TRUE because there is duplicate i.e. A1=A2=1.  So far so good.
Please do "evaluate formula" at this time.  You will see {2,2,1,1,.....}
and
this makes sense.  I just want to make note of the lst and 2nd "2".

Now clear A1 and A2 by pressing del key and you have two blank cells.
You
get a FALSE.  I can accept that the formula ignore two blanks.  Now the
following confuses me.

You still have A1 and A2 as two empty blank cells, right?  Now, key in
=""
to A1.  Do you get TRUE?  So, what is the duplicate here?  Let's do
"evaluate formula" and you will see just ONE "2".  I can't explain this.
Remember earlier when we have A1 and A2 being "1" evaluate formula shows
us
{2,2,1,1,......}.  It doesn't make sense to me that there is only ONE
"2"
now.  If there is a duplicate, there should be another "2" somewhere
between
the { }.

Is this a bug or am I going "crazy?"  By the way, I use version 2003.
Would
you mind telling me if you have got the same.

Now, I am going to explore the following which is better to search for
duplicates.

=IF(COUNTA(A1:A10),MAX(FREQUENCY(A1:A10,A1:A10))>1,"")

I appreciate your help.

Epinn

Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:OQF8NFx8GHA.3644@TK2MSFTNGP03.phx.gbl...

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:#GnoC8w8GHA.4740@TK2MSFTNGP02.phx.gbl...
I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u42GA4w8GHA.3264@TK2MSFTNGP04.phx.gbl...
Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u5KsSGw8GHA.3820@TK2MSFTNGP02.phx.gbl...
I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn

Epinn - 21 Oct 2006 21:13 GMT
Our (Roger's and my) previous tests using COUNTIF tell us that blank but not null string is treated as 0.  My subsequent test using SUMPRODUCT/COUNTIF tells us that null string (="") but not blank is treated like 0.  These tests contradict one another.

Then Sandy's test reveals that blank and null string have another story between the two of them not having zero as part of the picture this time.  I have taken Sandy's test further.  Using the same array formula

=COUNTIF(A1:A10,A1:A10)

and highlighting B1 to B10, I reverse Sandy's entries for A1:A10 i.e. I leave A1 as blank and key in ="" to the rest.  But the result is not reversed accordingly.  I have got 2,1,1,1,1,1,1,1,1,1.  Remember with Sandy's data set (the opposite of mine) the result is 10,0,0,0,0,0,0,0,0,0,0?  What is the message this time?  Can someone say this in English?    

Will digest Pete's and Roger's posts later.  I shall make a point to tie up the loose ends this weekend and *move on with my life*.  When I started this thread, I just wanted to make a comment and didn't expect all this *endless* confusion.

Epinn  

Epinn,

Just to muddy the waters try this:

in a1 enter ="" and leave A2:A10 empty

now highlight B1+B10 and enter:

=COUNTIF(A1:A10,A1:A10)

and complete it by array entering the formula(s) with Ctrl + Shift + Enter

I get:

10
0
0
0
0
0
0
0
0
0

Therefore to Excel   "" = Blank but Blank <> ""

Go figure!

Signature

HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

sandymann2@mailinator.com
Replace@mailinator.com with @tiscali.co.uk

Roger,

I should stop playing with blank, null, zero etc. real soon or I may go
"insane."

Let me tell you what I have found.  Not sure if it is a bug.

Key in 1,2,3,4,5,6,7,8,9,0 to A1:A10 respectively i.e. A1 = 1, A2 = 2 etc.
etc.

Then key in the following somewhere.

=SUMPRODUCT(COUNTIF(A1:A10,A1:A10))>10

You get a FALSE because there is no duplicate.  Now, change the "2" in A2 to
"1".

You get a TRUE because there is duplicate i.e. A1=A2=1.  So far so good.
Please do "evaluate formula" at this time.  You will see {2,2,1,1,.....} and
this makes sense.  I just want to make note of the lst and 2nd "2".

Now clear A1 and A2 by pressing del key and you have two blank cells.  You
get a FALSE.  I can accept that the formula ignore two blanks.  Now the
following confuses me.

You still have A1 and A2 as two empty blank cells, right?  Now, key in =""
to A1.  Do you get TRUE?  So, what is the duplicate here?  Let's do
"evaluate formula" and you will see just ONE "2".  I can't explain this.
Remember earlier when we have A1 and A2 being "1" evaluate formula shows us
{2,2,1,1,......}.  It doesn't make sense to me that there is only ONE "2"
now.  If there is a duplicate, there should be another "2" somewhere between
the { }.

Is this a bug or am I going "crazy?"  By the way, I use version 2003.  Would
you mind telling me if you have got the same.

Now, I am going to explore the following which is better to search for
duplicates.

=IF(COUNTA(A1:A10),MAX(FREQUENCY(A1:A10,A1:A10))>1,"")

I appreciate your help.

Epinn

Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn
Sandy Mann - 21 Oct 2006 21:30 GMT
Epinn,

I am not sure that we are proving anything here but I found that with ="" in
A1 and A2:A10 left untouched I got 0,10,10,10,10,10,10,10,10,10 form an
array entered =COUNTIF(A1:A10,A1:A10) and using XL97

Signature

HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

sandymann2@mailinator.com
Replace@mailinator.com with @tiscali.co.uk

Our (Roger's and my) previous tests using COUNTIF tell us that blank but not
null string is treated as 0.  My subsequent test using SUMPRODUCT/COUNTIF
tells us that null string (="") but not blank is treated like 0.  These
tests contradict one another.

Then Sandy's test reveals that blank and null string have another story
between the two of them not having zero as part of the picture this time.  I
have taken Sandy's test further.  Using the same array formula

=COUNTIF(A1:A10,A1:A10)

and highlighting B1 to B10, I reverse Sandy's entries for A1:A10 i.e. I
leave A1 as blank and key in ="" to the rest.  But the result is not
reversed accordingly.  I have got 2,1,1,1,1,1,1,1,1,1.  Remember with
Sandy's data set (the opposite of mine) the result is
10,0,0,0,0,0,0,0,0,0,0?  What is the message this time?  Can someone say
this in English?

Will digest Pete's and Roger's posts later.  I shall make a point to tie up
the loose ends this weekend and *move on with my life*.  When I started this
thread, I just wanted to make a comment and didn't expect all this *endless*
confusion.

Epinn

Epinn,

Just to muddy the waters try this:

in a1 enter ="" and leave A2:A10 empty

now highlight B1+B10 and enter:

=COUNTIF(A1:A10,A1:A10)

and complete it by array entering the formula(s) with Ctrl + Shift + Enter

I get:

10
0
0
0
0
0
0
0
0
0

Therefore to Excel   "" = Blank but Blank <> ""

Go figure!

Signature

HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

sandymann2@mailinator.com
Replace@mailinator.com with @tiscali.co.uk

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:eMIAxRI9GHA.4572@TK2MSFTNGP02.phx.gbl...
Roger,

I should stop playing with blank, null, zero etc. real soon or I may go
"insane."

Let me tell you what I have found.  Not sure if it is a bug.

Key in 1,2,3,4,5,6,7,8,9,0 to A1:A10 respectively i.e. A1 = 1, A2 = 2 etc.
etc.

Then key in the following somewhere.

=SUMPRODUCT(COUNTIF(A1:A10,A1:A10))>10

You get a FALSE because there is no duplicate.  Now, change the "2" in A2 to
"1".

You get a TRUE because there is duplicate i.e. A1=A2=1.  So far so good.
Please do "evaluate formula" at this time.  You will see {2,2,1,1,.....} and
this makes sense.  I just want to make note of the lst and 2nd "2".

Now clear A1 and A2 by pressing del key and you have two blank cells.  You
get a FALSE.  I can accept that the formula ignore two blanks.  Now the
following confuses me.

You still have A1 and A2 as two empty blank cells, right?  Now, key in =""
to A1.  Do you get TRUE?  So, what is the duplicate here?  Let's do
"evaluate formula" and you will see just ONE "2".  I can't explain this.
Remember earlier when we have A1 and A2 being "1" evaluate formula shows us
{2,2,1,1,......}.  It doesn't make sense to me that there is only ONE "2"
now.  If there is a duplicate, there should be another "2" somewhere between
the { }.

Is this a bug or am I going "crazy?"  By the way, I use version 2003.  Would
you mind telling me if you have got the same.

Now, I am going to explore the following which is better to search for
duplicates.

=IF(COUNTA(A1:A10),MAX(FREQUENCY(A1:A10,A1:A10))>1,"")

I appreciate your help.

Epinn

Hi Epinn

i may be entirely wrong here, and I am quite willing to be shot down in
flames<bg>
I think there are 3 conditions
Zero in a  cell        0
an Empty cell        BLANK
Null in a cell           =""

Blank and Zero are counted as equivalent, but are both different from
Null.

Your test is looking at the whole of columns C through column G
Enter the following into cells A1:A7 respectively on a completely new
empty sheet
0, BLANK, ="", ="", BLANK, 0, BLANK
In B1 enter
=(COUNTIF(C:G,A1)>0)    and copy down through B2:B3
in B4 enter
=COUNTIF(C:G,A4)           and copy down through B5:B6
In B7 enter
=COUNTIF(C:G,A7)+COUNTIF(C:G,"")

The results you will see are
FALSE, FALSE, TRUE, 327680, 0, 0 , 327680

Now enter a 0 in say cell D1 and you will see the results change to
TRUE, TRUE, TRUE, 327679, 1, 1, 327680

So you can see that the count for a totally Blank cell is the same as
the count for a Zero cell, but is different from the count for a Null
cell ""

You would need to combine both cases if you want to return True for 0 or
Null as
=COUNTIF(C:G,A7)>0+COUNTIF(C:G,"")>0
(here the plus sign is acting equivalent to the "OR" condition)

Signature

Regards

Roger Govier

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:OQF8NFx8GHA.3644@TK2MSFTNGP03.phx.gbl...

>>>   =IF(A1<>"",COUNTIF(C:G,A1)>0)
>>>   COUNTIF(C:G,A1)>0

If A1 is blank and there is a blank in C:G, I don't get TRUE with the
second formula.  That is why I say I have to use COUNTBLANK.

Have I confused everyone now?

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:#GnoC8w8GHA.4740@TK2MSFTNGP02.phx.gbl...
I know I can use the following formula to differentiate.

=IF(A1<>"",COUNTIF(C:G,A1)>0)

I was just surprised that blanks and zeros are treated the same.

Epinn

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u42GA4w8GHA.3264@TK2MSFTNGP04.phx.gbl...
Should have included my formula instead of writing lines.  Although I
say column, I use each cell in the column as a criterion.  The formula
is copied down.

=COUNTIF(C:G,A1)>0

What I want to say is if A1 = 0 or blank, and 0 doesn't exist in C:G, I
get FALSE.  If 0 exists in C:G, I get TRUE.  If A1 is a blank, I don't
want to see TRUE.

>>  =COUNTIF(A:A,"") counts blanks for me.  <<

Yes, when you include "" as part of the syntax.

For my experiment, H1 is a blank and =COUNTIF(A:A,H1) returns 0.

Epinn

You are not making sense (at least to me). What does another column have
to
do with it, COUNTIF works on a single range.

=COUNTIF(A:A,"") counts blanks for me.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Epinn" <someone@example.com.NO_SPAM> wrote in message
news:u5KsSGw8GHA.3820@TK2MSFTNGP02.phx.gbl...
I want to use COUNTIF > 0 to determine if a value in column A exists in
another column.  This works fine for non-blank and non-zero cells.
COUNTIF
appears to handle a blank and a "0" the same way.  If they exist in
column A
and a blank exists in another column, FALSE will be returned for both
"0"
and blank.  If a "0" exists in another column, TRUE will be returned for
both "0" and blank.  Wonder how I can differentiate between the two.  If
I
have a blank in column A and a "0" in another column, I don't want to
consider it a match.  Guess I have to use COUNTBLANK on the two columns
respectively.

Any comments?

Epinn

Roger Govier - 21 Oct 2006 22:34 GMT
Hi Sandy

I tried it in all versions of XL from 97 to 2003 and got
10,0,0,0,0,0,0,0,0,0
in all cases.

Windows XP Professional
Version 5.1.2600 Service Pack 2 Build 2600
Xl 97 SR-1
Signature

Regards

Roger Govier

> Epinn,
>
[quoted text clipped - 145 lines]
>
> =COUNTIF(A:A,"") counts blanks for me.
Sandy Mann - 22 Oct 2006 14:42 GMT
Roger,

Yes that is what I get today - I don't know what I did unless I was so
confused that I completely reversed everything.

Signature

Regards,

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

sandymann2@mailinator.com
Replace@mailinator.com with @tiscali.co.uk

> Hi Sandy
>
[quoted text clipped - 149 lines]
>>
>> =COUNTIF(A:A,"") counts blanks for me.
Roger Govier - 22 Oct 2006 14:55 GMT
Sandy

>unless I was so confused that I completely reversed everything.

and I thought I had a monopoly on that particular trait!!   <bg>

Signature

Regards

Roger Govier

> Roger,
>
[quoted text clipped - 168 lines]
>>>
>>> =COUNTIF(A:A,"") counts blanks for me.
Epinn - 23 Oct 2006 09:25 GMT
>>  and I thought I had a monopoly on that particular trait!!   <bg>

Oh, no, I'll be the first one to get confused and I also confuse others around me too.  <bg>

Confusion is contagious.  Earlier I posted a few long formulae on SUM, 1/COUNTIF etc. which can cause some confusion.  By the way, I didn't create those formulae ......

Thank you all for playing along.  I appreciate it.  

Epinn

Sandy

>unless I was so confused that I completely reversed everything.

and I thought I had a monopoly on that particular trait!!   <bg>

Signature

Regards

Roger Govier

> Roger,
>
[quoted text clipped - 249 lines]
>>>
>>> Epinn
Lori - 19 Oct 2006 13:38 GMT
There are subtle differences between the various syntaxes:

=COUNTBLANK(A:A)   counts all blanks and null strings (="") in column
=COUNTIF(A:A,"")       counts blanks and null strings (="") up to last
used row
=COUNTIF(A:A,"=")     counts only true blank cells up to last used row
Epinn - 19 Oct 2006 23:45 GMT
Lori,

Thanks for your post.  I enjoy details.

>> =COUNTBLANK(A:A)   counts all blanks and null strings (="") in column  <<

Agree.  Same as my previous experiment.  Result: 65536.
 
>> =COUNTIF(A:A,"")       counts blanks and null strings (="") up to last
used row <<

Don't understand what you meant by "up to last used row."  I key some text into A2006 and I get 65535.  Last used row is 2006?  Please explain.

=COUNTIF(A:A,"=")     counts only true blank cells up to last used row

Do you know of any link that I can read about "="?  I like it.  However, I have the same problem with "last used row" as stated above.  Please explain.

Thanks.

Epinn

There are subtle differences between the various syntaxes:

=COUNTBLANK(A:A)   counts all blanks and null strings (="") in column
=COUNTIF(A:A,"")       counts blanks and null strings (="") up to last
used row
=COUNTIF(A:A,"=")     counts only true blank cells up to last used row
Lori - 20 Oct 2006 10:40 GMT
Hi Epinn - If you press Ctrl+End it will take you to the last used
cell, (equivalent to Edit > Goto > Special > Last Cell). COUNTIF
formulas on this version (XL2002 SP3) only count data in the range up
to the last cell, maybe you have a later version?

Regarding the last formula, preceding text by "=" in the criteria
generally has no effect but if an "=" sign is the only criteria only
blanks are included (you could think of an invisible blank following
the = sign).  Similarly with "<>" as criteria only non blank cells
would be counted.

Lori

> Lori,
>
[quoted text clipped - 23 lines]
> used row
> =COUNTIF(A:A,"=")     counts only true blank cells up to last used row
Epinn - 20 Oct 2006 19:20 GMT
Thanks for your response.  It looks like COUNTIF works differently on version 2003.  I didn't know that.  As I stated in my previous post, it counts beyond the last used cell.

Look forward to chatting with you again in the future.

Epinn

Hi Epinn - If you press Ctrl+End it will take you to the last used
cell, (equivalent to Edit > Goto > Special > Last Cell). COUNTIF
formulas on this version (XL2002 SP3) only count data in the range up
to the last cell, maybe you have a later version?

Regarding the last formula, preceding text by "=" in the criteria
generally has no effect but if an "=" sign is the only criteria only
blanks are included (you could think of an invisible blank following
the = sign).  Similarly with "<>" as criteria only non blank cells
would be counted.

Lori

Epinn wrote:

> Lori,
>
[quoted text clipped - 24 lines]
> used row
> =COUNTIF(A:A,"=")     counts only true blank cells up to last used row
Epinn - 27 Oct 2006 04:57 GMT
In case anyone is interested, F5>Special>Blanks only picks up true blanks but not null strings (="").

I want to use COUNTIF > 0 to determine if a value in column A exists in another column.  This works fine for non-blank and non-zero cells.  COUNTIF appears to handle a blank and a "0" the same way.  If they exist in column A and a blank exists in another column, FALSE will be returned for both "0" and blank.  If a "0" exists in another column, TRUE will be returned for both "0" and blank.  Wonder how I can differentiate between the two.  If I have a blank in column A and a "0" in another column, I don't want to consider it a match.  Guess I have to use COUNTBLANK on the two columns respectively.

Any comments?

Epinn  
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.