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.

Sheet1
AV
AW
AX
AY
AZ
BA
countAV
countAW
countAX
countAY
countAZ
countBA
3
kyle@gmail.com
tony@hotmail.com
dad@gmail.coom
0
2
0
4
sara@yahoo.com
2
5
jim@gmail.com
john@gmail.com
0
0
6
kyle@gmail.com
0
7
kyle@gmail.com
0
8
tony@hotmail.com
sara@yahoo.com
2
2

<tbody>
</tbody>


Sheet2
A
1
gmail.com
2
aol.com
3
excel.com
4
word.com

<tbody>
</tbody>


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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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,216,561
Messages
6,131,403
Members
449,650
Latest member
Adamd325

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