Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Count if two cells are equal

Status
Not open for further replies.

coolkake

Technical User
Apr 5, 2002
51
CA
Hi

I've looked for a way to do this but I can't seem to find what I'm looking for so here's my issue

I want to count all the location where colum B equals what is in colum C in the spread sheet. Below is an example and there are blank fields in between each of these entries; sometimes just one and other times there are 20. Grouping is used on this spreadsheet.

Any help would be greatly appreciated.

Thanks

Ken

B C
13 13
1 13
1 15
1 13
1 10
1 12
1 22
1 16
1 15
1 12
20 20
 



Hi,

All kind of ways to do this...

in col D
[tt]
=if(B1=C1,1,0)
[/tt]
copy down

then SUM column D

Skip,
[sub]
[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue][/sub]
 
Is there a way to have this ignore null values? This works great but when I try do paste is for the entire colum all the empty spaces show up with 1 because they match.
 


Turn on AutoFilter and select cells that are Not Blank in column D

Skip,
[sub]
[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue][/sub]
 


Turn on AutoFilter and select cells that are Not Blank in column B.

THEN use
[tt]
=SUBTOTAL(9,D:D)
[/tt]


Skip,
[sub]
[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue][/sub]
 
Is there nothing I can put in the fomula to ignore blank cells?
=if(B1=C1,1,0) gives me what I'm looking for but then when I paste this down the colum it adds a 1 to all the blank fields.

SkipVought, don't really want to use the AutoFilter for this particular sheet. Thanks though.
 



No Filter needed...
[tt]
=SUMPRODUCT(--(BBB<>"")*(DDD=1))
[/tt]
where BBB is the data range in column B and DDD is the data range in column D

Skip,
[sub]
[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue][/sub]
 
How about this?

=IF(B1-C1=0,1,0)

Assumptions:
1.) You are only working with numbers
 




some cells are empty in columns B & C.

Skip,
[sub]
[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top