countif

Sharkie21

Active Member
Joined
Nov 2, 2005
Messages
319
Can someone tell me why this is not working?

=COUNTIF(Data!O3:O2126,AND(Data!O3:O2126="POP",Data!N3:N2126="COKE"))

so if I have

O N
POP COKE
POP COLA
POP PEPSI

to give me 1.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Countif doesn't work with more than 1 criteria...

try:

=Sumproduct(--(Data!O3:O2126="POP"),--(Data!N3:N2126="COKE"))
 
Upvote 0
Hi

You need another formula such as SUmproduct:

Code:
=SUMPRODUCT((Data!O3:O2126="POP")+0,(Data!N3:N2126="COKE")+0)
 
Upvote 0
Hi

Try SUMPRODUCT:

=SUMPRODUCT(--(O3:O2126="pop"),--(N3:N2126="coke"))

SYNTAX IS:

=sumproduct(--(range1=contidtion1),--(range2=condition2))
 
Upvote 0
What about something like this

SUMPRODUCT(--(Data!$O$3:$O$2126="POP"),--(Data!$N$3:$N$2126="COKE"),--OR(Data!$W$3:$W$2126="Y",Data!$W$3:$W$2126="D)")

O N W
POP COKE Y
POP COKE D
POP COKE E

I want 2.
 
Upvote 0
Maybe:

Code:
SUMPRODUCT(--(Data!$O$3:$O$2126="POP"),--(Data!$N$3:$N$2126="COKE"),SIGN((Data!$W$3:$W$2126="Y")+(Data!$W$3:$W$2126="D")))
 
Upvote 0
Returns 0 if argument is 0, 1 if argument is positive (ie >0) - ---- also returns -1 if argument is negative, but that won't happen in this formula.
 
Upvote 0
Richard uses a function call rather than a "--" because when performing the OR operation, you need to use "+". By using a function we avoid typing "+--".

You could use the N() functino as well.
 
Upvote 0

Forum statistics

Threads
1,214,414
Messages
6,119,373
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top