# Countif Multiple Criteria Met in Same Row

#### MattDexx

##### New Member
Hello, I'd greatly appreciate your help solving this issue. I'm running Excel 2012 on MS 365

I have a large data set pulled from a registration system that includes, among other things, separate columns for last names and first names of those who have registered. On a different tab, I've hand-coded in a small number of specific names (with last names and corresponding first names in separate columns) with a third column that would indicate either "yes" or "no" (yes indicating that they have registered and no indicating that they haven't).

I've done a two criteria Countif, but I've realized that it replies "yes" if either the last name or the first name appears in the registration data. For example, if I'm trying to determine if Smith John has registered, the Countif will produce a "yes" if a Smith Eric and a Gonzalez John have registered even if a Smith John hasn't. I need it to only reply "yes" if it meets the criteria of Smith John on the same row of the data set.

Any help would be tremendously appreciated. THANK YOU!

### Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

#### BenMiller

##### Well-known Member
With your raw data on Sheet1, last name in column A and first name in B - and on Sheet 2 it's the same setup, try this:

=IF(SUMPRODUCT((Sheet1!A:A=A1)*(Sheet1!B:B=B1))=0,"No","Yes")

#### Fluff

##### MrExcel MVP, Moderator
Hi & welcome to MrExcel.
Excel Formula:
``=IF(COUNTIFS(A:A,F2,B:B,G2),"yes","No")``
where F2 & G2 hold the names

#### MattDexx

##### New Member
With your raw data on Sheet1, last name in column A and first name in B - and on Sheet 2 it's the same setup, try this:

=IF(SUMPRODUCT((Sheet1!A:A=A1)*(Sheet1!B:B=B1))=0,"No","Yes")
Huge thank you!! Both worked. Really appreciate how quickly you responded!

#### Fluff

##### MrExcel MVP, Moderator
Glad we could help & thanks for the feedback.

I would recommend against using whole column references with sumproduct, as it can slow your workbook down considerably.

Replies
5
Views
47
Replies
3
Views
151
Replies
13
Views
68
Replies
10
Views
799
Replies
11
Views
203

1,130,157
Messages
5,640,460
Members
417,143
Latest member

### 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.

### Which adblocker are you using?

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

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