![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,738
|
Ok, are you ready for this ? you CAN use COUNTIF with multiple ranges, non contigous, etc.
For example, I have this three ranges: A2:D2 {1,2,3,2} given the name Rng1 B4:G5 {5,6,7,8,9,10;2,3,4,5,6,7} name: Rng2 A7:A9 {2;4;6} name: Rng3 Now, say I want to count the number of 2s in the three ranges. I can use this simple formula: =SUM(COUNTIF(INDIRECT({"Rng1","Rng2","Rng3"}),2)) it's not even array entered ! Here's the Excel model (Yellow range = Rng1, Green = Rng2, Blue = Rng3) you can also use this approach for non named ranges, i.e.: =SUM(COUNTIF(INDIRECT({"A2:D2","B4:G5","A7:A9"}),2)) ******** ******************** ************************************************************************>
[HtmlMaker 2.20] To see the formula in the cells just click on the cells hyperlink or click the Name box PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|