# COUNTIF [criteria] + give %

#### Tomas4

##### New Member
Hi guys,

Was trying to crack this one up, got nothing but a head buzzing by now...

A2 B2 C2 D2 E2 F2 G2 H2 I2 J2 K2 L2
y y y y n y n n o o

What would be a formula to calculate % for:

Count ONLY if A2:L2 is 'y' AND 'n', ignoring anything else (blank or 'o')

Then give me a % for how many correct answers ('y') vs incorrect answers ('n')

So in this example it would be:

Total Count: 8 (5 x 'y' & 3 x 'n')
% Correct: 63%

Any suggestions?

Thank you!

### Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

#### steve the fish

##### Well-known Member
You can try:

=COUNTIF(\$A\$2:\$J\$2,"y")/SUM(COUNTIF(\$A\$2:\$J\$2,{"y","n"}))

then format to percentage

#### AlanY

##### Well-known Member
like this?

Excel 2012
ABCDEFGHIJKL
2yyyynynnoo
3
4y5
5n3
6y+n8
7%y62.5%
8%n37.5%
9
Sheet4
Cell Formulas
RangeFormula
B4=COUNTIF(\$A\$2:\$L\$2,A4)
B5=COUNTIF(\$A\$2:\$L\$2,A5)
B6=B4+B5
B7=B4/\$B\$6
B8=B5/\$B\$6

##### MrExcel MVP
Like this:

=COUNTIFS(A2:L2,"Y")/SUM(COUNTIFS(A2:L2,{"y","n"}))

#### Tomas4

##### New Member
It worked, thank you so much guys!

Replies
2
Views
179
Replies
3
Views
116
Replies
10
Views
369
Replies
9
Views
420
Replies
2
Views
99

1,190,896
Messages
5,983,441
Members
439,843
Latest member
PlanetFitness

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