Help with Count, three variables

Hannainnc

New Member
Hi everyone. I have a feeling that this is probably really simple, but I can't seem to figure it out. Hopefully you all will have the answer to my dilemma.

All I want to do is do a COUNTIF, but I need to get a count if it meets three criteria, all from the same row. I did have =COUNTIF(\$G:\$G,"SNGL")
and this worked for me, but now I need to also include in this count cells with SNGL, CBSG, and SBSG. I tried entering the three in my formula and got an error message saying I have too many variables.

Hanna

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Welcome to the board!

Do you want to count if it is ANY of those three? Or ALL of those three?

for the first, =COUNTIF(\$G:\$G,"SNGL") + COUNTIF(\$G:\$G,"CBSG") + COUNTIF(\$G:\$G,"SBSG")

For the second,
=sumproduct(--(A1:A10 = "SNGL"),--(B1:B10 = "CBSG"), --(C1:C10 = "SBSG"))

Hannainnc said:
Hi everyone. I have a feeling that this is probably really simple, but I can't seem to figure it out. Hopefully you all will have the answer to my dilemma.

All I want to do is do a COUNTIF, but I need to get a count if it meets three criteria, all from the same row. I did have =COUNTIF(\$G:\$G,"SNGL")
and this worked for me, but now I need to also include in this count cells with SNGL, CBSG, and SBSG. I tried entering the three in my formula and got an error message saying I have too many variables.

Hanna

Try,

=SUMPRODUCT(--(ISNUMBER(MATCH(G1:G100,A1:A3,0))))

Where A1:A3 house the criterias and no whole column references

Edit,

After reading you question again, do you want OR'ing or AND'ing? You say row, as in A1:K1 or columns A1:A10?

Oops..I am such a noob. I meant all from the same column, not row. I'll get that lingo down soon...I hope.

I need count of OR and I used the first method and it worked. Thank you so much.

Have a great weekend everyone!

Replies
6
Views
121
Replies
6
Views
424
Replies
3
Views
300
Replies
11
Views
799
Replies
1
Views
366

1,202,990
Messages
6,052,957
Members
444,621
Latest member
MIKOLAJ_R

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.

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