ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   COUNTIF with multiple disjoint ranges, same criteria (https://www.excelbanter.com/new-users-excel/75199-re-countif-multiple-disjoint-ranges-same-criteria.html)

Bob Phillips

COUNTIF with multiple disjoint ranges, same criteria
 
=SUMPRODUCT(COUNTIF(INDIRECT({"A1:C3","D4:F6","G7: I9"}),"Y"))

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Kurt Swanson" wrote in message
...
Is there any way to specify multiple disjoint ranges in one COUNTIF?

I.e. something like COUNTIF((A1:C3,D4:F6,G7:I9),"Y")

I want to avoid COUNTIF(A1:C3,"Y") + COUNTIF(D4:F6,"Y") + ...
--
© 2005 Kurt Swanson AB




Ron Coderre

COUNTIF with multiple disjoint ranges, same criteria
 
=SUMPRODUCT(COUNTIF(INDIRECT({"A1:C3","D4:F6","G7: I9"}),"Y"))

Nicely done, Bob! It works fine in my test.

***********
Regards,
Ron

XL2002, WinXP-Pro


"Bob Phillips" wrote:

=SUMPRODUCT(COUNTIF(INDIRECT({"A1:C3","D4:F6","G7: I9"}),"Y"))

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Kurt Swanson" wrote in message
...
Is there any way to specify multiple disjoint ranges in one COUNTIF?

I.e. something like COUNTIF((A1:C3,D4:F6,G7:I9),"Y")

I want to avoid COUNTIF(A1:C3,"Y") + COUNTIF(D4:F6,"Y") + ...
--
© 2005 Kurt Swanson AB






All times are GMT +1. The time now is 05:55 AM.

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