Countif multiple ranges of different sizes

Joined
Jul 28, 2010
Messages
10
I am using Excel 2010.

I have a spreadsheet where column A is for Quarter, column B is for Employee, and columns C-R are for Codes (Code1; Code2; Code3; etc. through Code15). One line might have no values in the codes columns, another might have values in only Code1, another might have values in Code1 and Code2, and another might have values in all 15 columns.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p></o:p>
A B C D E F --> R<o:p></o:p>
1 Qtr Emp Code01 Code02 Code03 Code04 --> to Code15 <o:p></o:p>
2 2012.1 Liz CER02 INS12 WKH15<o:p></o:p>
3 2012.2 Jim PIN55 WKH12 WKH19 WKH23<o:p></o:p>
4 2012.2 Jon <o:p></o:p>
5 2012.2 Jim WKH15 WKH23<o:p></o:p>
6 2012.2 Jon PIN55 WKH15 WKH12 CER08
<o:p></o:p>
The worksheet is named “ALLAUDITS” and the named ranges are as follows: <o:p></o:p>
<o:p></o:p>
Quarter: =offset(allaudits!$A$1,0,0,counta(allaudits!$A:$A),1)<o:p></o:p>
Employee: =offset(allaudits!$B$1,0,0,counta(allaudits!$B:$B),1)<o:p></o:p>
CodeData: =offset(allaudits!$C$1,0,0,counta(allaudits!$C:$C),15)<o:p></o:p>
<o:p></o:p>
On another worksheet I need to be able to count how many times WKH15 appears in the CodeData range within a certain Quarter. I tried
=countifs(Quarter,"2012.2",CodeData,"WKH15") but that didn't work, and from what I can tell in Excel Help, it's because the ranges are different sizes. I have over 6500 rows, so I'm trying to avoid having to name all 15 columns and then do a sumproduct on all of them, such as
=sumproduct((Quarter="2012.2")*((Code1="WKH15")+(Code2="WKH15")+.......)))
Calculation would take forever.

I've been googling for three days and scouring this and other message boards, but cannot find anything that will work. In an Excelutopia, I could just create a pivot table based on the "allaudits" worksheet, but I can't figure out how to get the actual codes as the row headers (instead of Code1, Code2, Code3, etc.). So if you know how to make THAT happen instead, I'd be ecstatic!!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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