Count If Multiple Criteria

kparadise

Board Regular
Joined
Aug 13, 2015
Messages
186
Hello,

I need to count using two criteria. I have a range of user emails; AV3:BA100 in Sheet1; these are the data points I am trying to analyze. I also have a range of email domains for reference, which will come into play later in A1:A4 in Sheet2.

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Sheet1
[/TD]
[TD]AV
[/TD]
[TD]AW
[/TD]
[TD]AX
[/TD]
[TD]AY
[/TD]
[TD]AZ
[/TD]
[TD]BA
[/TD]
[TD]countAV
[/TD]
[TD]countAW
[/TD]
[TD]countAX
[/TD]
[TD]countAY
[/TD]
[TD]countAZ
[/TD]
[TD]countBA
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]kyle@gmail.com
[/TD]
[TD]tony@hotmail.com
[/TD]
[TD]dad@gmail.coom
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]0
[/TD]
[TD]2
[/TD]
[TD]0
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]sara@yahoo.com
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]2
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]jim@gmail.com
[/TD]
[TD]john@gmail.com
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD]kyle@gmail.com
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]0
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]kyle@gmail.com
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]0
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8
[/TD]
[TD]tony@hotmail.com
[/TD]
[TD]sara@yahoo.com
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]2
[/TD]
[TD]2
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Sheet2
[/TD]
[TD]A
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]gmail.com
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]aol.com
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]excel.com
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]word.com
[/TD]
[/TR]
</tbody>[/TABLE]


What I am trying to do is in cell countAV, look at the value in AV, and count how many times that exact email appears in the entire AV3:BA100; BUT the email domain needs not to be found in Sheet2 A1:A4. You can see the red values which I am looking for. I can do each count, but I do not know how to put them together.

=COUNTIFS($AV$3:$BA$100, AV3)
=SUMPRODUCT(--ISNA(MATCH(AV3, {"Sheet2!$A$1:$A$4"},0)))
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
How about


Excel 2013/2016
ABCDEFGHIJKL
2countAVcountAWcountAXcountAYcountAZcountBA
3kyle@gmail.comtony@hotmail.comdad@gmail.com020000
4sara@yahoo.com200000
5jim@gmail.comjohn@gmail.com000000
6kyle@gmail.com000000
7kyle@gmail.com000000
8tony@hotmail.comsara@yahoo.com220000
Names
Cell Formulas
RangeFormula
G3{=IF(ISNUMBER(SEARCH(Sheet2!$A$1:$A$4,A3)),0,COUNTIF(Names!$A$3:$F$8,Names!A3))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
I actually changed the first part of that If statement to my original SUMPRODUCT function.

{=IF(SUBPRODUCT(--ISNUMBER(SEARCH(Sheet2!$A$1:$A$4,A3))),0,COUNTIF(Names!$A$3:$F$8,Names!A3))}
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,989
Members
452,541
Latest member
haasro02

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