Nested Countif statements

crimlet

Board Regular
Joined
May 2, 2002
Messages
136
Is it possible to nest countif statements, if so could someone post some examples ?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Larry_S

New Member
Joined
Sep 25, 2002
Messages
10
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.
 
Upvote 0

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
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.
 
Upvote 0

Forum statistics

Threads
1,191,610
Messages
5,987,659
Members
440,104
Latest member
thigarette

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top