# countif (nested)

#### tomk

##### New Member
I want to identify the number of iterations of more than one value (e.g, 47 and 54 in more than one range (four ranges).

Here is my cumbersome function as it now stands:
=COUNTIF(\$I\$3:\$K\$38, 47)+COUNTIF(\$T\$3:\$V\$32, 47)+COUNTIF(\$AC\$3:\$AE\$42, 47)+COUNTIF(\$AK\$3:\$AM\$42, 47)+COUNTIF(\$I\$3:\$K\$38, 54)+COUNTIF(\$T\$3:\$V\$32, 54)+COUNTIF(\$AC\$3:\$AE\$42, 54)+COUNTIF(\$AK\$3:\$AM\$42, 54)

Can I nest the arguments to downsize the function? Thanks

### Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I know this is not the best solution, but it will reduce the size of your formula.

=SUM(COUNTIF(\$I\$3:\$K\$38,A1:A2)+COUNTIF(\$T\$3:\$V\$32,A1:A2)+COUNTIF(\$AC\$3:\$AE\$42,A1:A2)+COUNTIF(\$AK\$3:\$AM\$42,A1:A2))

Enter this as an array formula using CTRL-SHIFT-Enter and make sure that A1:A2 has 47 and 54 entered in it. I have used A1:A2 as an example only, use any cells you want.

HTH

Problem is that the values 47 or 54 may appear randomly in any cell within any of the four ranges. In essence, I am trying to monitor its appearance.

You could name the ranges (see Dynamic ranges and offset)

=SUMPRODUCT((Ir={47,54})+(Jr={47,54})+(Kr={47,54})) etc.

Column I named Ir etc.

Replies
20
Views
480
Replies
1
Views
280
Replies
2
Views
184
Replies
5
Views
254
Replies
1
Views
436

1,218,909
Messages
6,145,167
Members
450,592
Latest member
Boulder127

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