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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
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,215,433
Messages
6,124,861
Members
449,195
Latest member
MoonDancer

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