# COUNTIFS formula

#### johns99

##### Board Regular
Hello,

I'm having issues with a COUNTIFS formula...I'm using the below

=COUNTIFS(\$CT\$6:\$CT\$7666,"P1",\$X\$6:\$X\$7666,{"x","+"})

this returns a result of 166, however when I filter on the above criteria "P1" and {"x","+"} I'm showing 217

Any ideas why this would not be working?

John

### Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

#### barry houdini

##### MrExcel MVP
You are only seeing the count for "x", you need an added SUM function to get the total for "x" and "+"

=SUM(COUNTIFS(\$CT\$6:\$CT\$7666,"P1",\$X\$6:\$X\$7666,{"x","+"}))

#### bbott

##### Well-known Member
It's only counting x's (the first value in the array). You would need to add a third argument so that x and + are separate.

#### johns99

##### Board Regular
Thank you both for your quick responses!

@barry houdini I've added the SUM and this fixed the problem. Thank you both, have a great weekend!

#### johns99

##### Board Regular
I do have an additional question that I hope one of you will be able to help me with...

Using the info above...so taking a count of "P1" and {"x","+"}...I am also trying to count information in column W. The issue is there are duplicates in column W that I would not want to include so I can find out how many unique values are in this column.

So I would like to take a count of how many unique values are in column W for people who are labeled with {"x","+"} in column X and "P1" in column CT.

Is this possible?

Let me know if I'm not clear.

#### barry houdini

##### MrExcel MVP
That's a bit trickier but you can use an "array formula" like this

=SUM(IF(FREQUENCY(IF(\$CT\$6:\$CT\$7666="P1",IF((\$X\$6:\$X\$7666="x")+(\$X\$6:\$X\$7666="+"),IF(\$W\$6:\$W\$7666<>"",MATCH(\$W\$6:\$W\$7666,\$W\$6:\$W\$7666,0)))),ROW(\$W\$6:\$W\$7666)-ROW(\$W\$6)+1),1))

confirmed with CTRL+SHIFT+ENTER

#### johns99

##### Board Regular
This worked! Thank you for all your help today, it's much appreciated.

Have a great weekend.

Cheers,

John

Replies
3
Views
213
Replies
3
Views
460
Replies
29
Views
1K
Replies
3
Views
684
Replies
7
Views
220

1,191,579
Messages
5,987,425
Members
440,096
Latest member
yanaungmyint

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