# Nested Countif statements

#### crimlet

##### Board Regular
Is it possible to nest countif statements, if so could someone post some examples ?

### Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I believe it would be more workable if you state what problem you want to solve.

I don't think it makes sense to nest them, since the reult of countif is just a number (a count), and the input to the outer countif would need to be a range or data value. Probably the results of the previous countif would not be a useful data value to use in the outer countif.

However, it is possible to add the results together, which corresponds to the logic of "count cells with either value1 or value2". For example:

=countif(A2:A20,"value1")+countif(A2:A20,"value2")

Or you can do some number range expressions, for example

=countif(A2:A20,"<= value2")-countif(A2:A20,"< value1")

should count the number of cells with values between value1 and value2, including any cells containing exactly value1 or value2 values.

I don't think it makes sense to nest them, since the reult of countif is just a number (a count), and the input to the outer countif would need to be a range or data value.

I disgree,

I often need to countif if first name = ?? and date start = ?? and paycode = ??.

three diferent ranges three types of data.

SUMPRODUCT should be the way forward or a Dfunction.

But as asked by Aladin, we need to be clear on the problem.

Replies
4
Views
171
Replies
1
Views
131
Replies
4
Views
106
Replies
5
Views
463
Replies
4
Views
393

1,218,660
Messages
6,143,747
Members
450,502
Latest member
sakaria_123

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