ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   countif - Criterion1 OR [Criterion2 AND Criterion3] (https://www.excelbanter.com/excel-worksheet-functions/44401-countif-criterion1-%5Bcriterion2-criterion3%5D.html)

0-0 Wai Wai ^-^

countif - Criterion1 OR [Criterion2 AND Criterion3]
 

I wish to do the following:
=countif(TargetCell or TargetCells, Criterion1 OR [Criterion2 AND Criterion3])

eg: =countif(A1, Criterion1 OR [Criterion2 AND Criterion3])
eg: =countif(A1:A10, Criterion1 OR [Criterion2 AND Criterion3])

How to do?

Thanks.

--
Additional information:
- I'm using Office XP
- I'm using Windows XP



bj

countif won't work well for this.
try sumproduct()

=sumproduct(or(targetcells=Crierion1,and(Targetcel ls=criterion2,targetcells=criterion3)))

"0-0 Wai Wai ^-^" wrote:


I wish to do the following:
=countif(TargetCell or TargetCells, Criterion1 OR [Criterion2 AND Criterion3])

eg: =countif(A1, Criterion1 OR [Criterion2 AND Criterion3])
eg: =countif(A1:A10, Criterion1 OR [Criterion2 AND Criterion3])

How to do?

Thanks.

--
Additional information:
- I'm using Office XP
- I'm using Windows XP




Aladin Akyurek

=SUMPRODUCT(--ISNUMBER(MATCH(TargetRange,CritList,0)))

where CritList refers to a range that houses the relevant criteria.

0-0 Wai Wai ^-^ wrote:
I wish to do the following:
=countif(TargetCell or TargetCells, Criterion1 OR [Criterion2 AND Criterion3])

eg: =countif(A1, Criterion1 OR [Criterion2 AND Criterion3])
eg: =countif(A1:A10, Criterion1 OR [Criterion2 AND Criterion3])

How to do?

Thanks.


Harlan Grove

Aladin Akyurek wrote...
=SUMPRODUCT(--ISNUMBER(MATCH(TargetRange,CritList,0)))

where CritList refers to a range that houses the relevant criteria.

....

That'd work for a single equality criteria, but that's not what the OP
asked. Looks like the OP needs something closer to

=SUMPRODUCT(--((range<=Crit1)+((range<=Crit2)*(range<=Crit3)) 0))

where <= is just a placeholder for any of the comparison operators.
It'd be more complicated with text criteria including wildcards.



All times are GMT +1. The time now is 04:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com