# Countif using two criteria

#### smithrd6

##### Board Regular
I have a worksheet which contains a column for part numbers and another for tag issue numbers. Not every occurance of part number will have a tag number issued. What I want to do is count the number of times a certain part number will have an occurance of a tag issue number.

PN Tag Issue Number

123 343
124 454
125 333
123
123 354

I'm not concerned with the blanks,

thanks

### Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
=sumproduct(--(A1:A10=123),--(B1:B10=343))

I understand it more like this:

=Sumproduct(--(\$A\$1:\$A\$10=C1),--(\$B\$1:\$B\$10<>""))

where C1 holds the part number to check for. Formula can be copied down.

Try this
=SUMPRODUCT(--(A1:A9<>""),--(B1:B9<>""))

sumproduct not working

I tried this with the only results being 0. For some reason, it will not pick up the part number.

=SUMPRODUCT(--(\$I\$2:\$I\$41000=A4),--(\$J\$2:\$J\$41000<>""))

Re: sumproduct not working

I tried this with the only results being 0. For some reason, it will not pick up the part number.

=SUMPRODUCT(--(\$I\$2:\$I\$41000=A4),--(\$J\$2:\$J\$41000<>""))

Make sure that the part in A4 has no spaces prior to or after as well as your data in column I. There have to be exact matches.

If this works, you know there are extraneous spaces.

=SUMPRODUCT(--(Trim(\$I\$2:\$I\$41000)=Trim(A4)),--(\$J\$2:\$J\$41000<>"")) but you will notice are marked slowdown in processing...so you shouldn't really use it. Instead fix your entries. You can find a TrimAll macro by doing a forum search that will clean up for you.

If it doesn't work, then are you sure there is at least one exact match?

Replies
4
Views
662
Replies
2
Views
153
Replies
20
Views
464
Replies
7
Views
328
Replies
1
Views
249

1,221,384
Messages
6,159,544
Members
451,571
Latest member
Qwissy

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