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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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
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,214,827
Messages
6,121,809
Members
449,048
Latest member
greyangel23

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
Back
Top