Countifs in two dimensional array, repeating header (non unique)

emichan

New Member
Joined
Sep 11, 2014
Messages
22
Hello,

I have a table like this:
FY2014FY2015Count?
TickerQ1Q2Q3Q4Q1Q2Q3Q4Q1Q2Q3Q4
A8/13/1411/13/142/13/146/26/148/14/1511/13/152/13/152221
B8/9/151411/14/142/13/146/26/148/7/1511/13/152/14/156/13/152222
C2/12/135/10/138/9/1412/13/142/10/155/9/152211

<tbody>
</tbody>
I'm trying to count how many inputs i have for particular ticker, for particular quarter, with no regard to year.
That is, I want to get an output that shows for
A, Q1= 2
B, Q4= 2
C, Q3= 1

I tried getting a pivot table, but the problem is i don't have unique header names, so I get Q1, Q2, Q3, Q4 and then Q12, Q22, etc...

Is there a way to get countif which looks up criteria range, criteria, and count range, like sumifs?

Thank you!!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Which version of Excel are you using?
For XL2007+, try

=COUNTIFS($B$2:$I$2,"Q1",INDEX($B$2:$I$4,MATCH("A",$A$2:$A$4,0),0),"<>")
 
Last edited:

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Or based on the cell references for A and Q1

=COUNTIFS($B$2:$I$2,K$2,$B3:$I3,"<>")
 
Last edited:

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Try the countifs (i did have to adjust the ranges a bit)

<b>Unknown</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #BBB"><colgroup><col width="25px" style="background-color: #DAE7F5" /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #DAE7F5;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th><th>H</th><th>I</th><th>J</th><th>K</th><th>L</th><th>M</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="text-align: right;;"></td><td style=";">FY2014</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">FY2015</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">Count?</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">Ticker</td><td style=";">Q1</td><td style=";">Q2</td><td style=";">Q3</td><td style=";">Q4</td><td style=";">Q1</td><td style=";">Q2</td><td style=";">Q3</td><td style=";">Q4</td><td style=";">Q1</td><td style=";">Q2</td><td style=";">Q3</td><td style=";">Q4</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">A</td><td style="text-align: right;;">08/13/2014</td><td style="text-align: right;;">11/13/2014</td><td style="text-align: right;;">02/13/2014</td><td style="text-align: right;;">06/26/2014</td><td style="text-align: right;;">08/14/2015</td><td style="text-align: right;;">11/13/2015</td><td style="text-align: right;;">02/13/2015</td><td style="text-align: right;;"></td><td style="text-align: right;;">2</td><td style="text-align: right;;">2</td><td style="text-align: right;;">2</td><td style="text-align: right;;">1</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">B</td><td style=";">8/9/1514</td><td style="text-align: right;;">11/14/2014</td><td style="text-align: right;;">02/13/2014</td><td style="text-align: right;;">06/26/2014</td><td style="text-align: right;;">08/07/2015</td><td style="text-align: right;;">11/13/2015</td><td style="text-align: right;;">02/14/2015</td><td style="text-align: right;;">06/13/2015</td><td style="text-align: right;;">2</td><td style="text-align: right;;">2</td><td style="text-align: right;;">2</td><td style="text-align: right;;">2</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";">C</td><td style="text-align: right;;">02/12/2013</td><td style="text-align: right;;">05/10/2013</td><td style="text-align: right;;">08/09/2014</td><td style="text-align: right;;">12/13/2014</td><td style="text-align: right;;">02/10/2015</td><td style="text-align: right;;">05/09/2015</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;">2</td><td style="text-align: right;;">2</td><td style="text-align: right;;">1</td><td style="text-align: right;;">1</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #BBB;border-top:none;text-align: center;background-color: #DAE7F5;color: #161120">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #BBB"><thead><tr style=" background-color: #DAE7F5;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">J3</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,J$2,$B3:$I3,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">K3</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,K$2,$B3:$I3,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">L3</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,L$2,$B3:$I3,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">M3</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,M$2,$B3:$I3,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">J4</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,J$2,$B4:$I4,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">K4</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,K$2,$B4:$I4,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">L4</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,L$2,$B4:$I4,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">M4</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,M$2,$B4:$I4,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">J5</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,J$2,$B5:$I5,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">K5</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,K$2,$B5:$I5,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">L5</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,L$2,$B5:$I5,"<>"</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">M5</th><td style="text-align:left">=COUNTIFS(<font color="#0000FF">$B$2:$I$2,M$2,$B5:$I5,"<>"</font>)</td></tr></tbody></table></td></tr></table><br />
 

Watch MrExcel Video

Forum statistics

Threads
1,130,174
Messages
5,640,593
Members
417,152
Latest member
DayTimeSeby

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
Top