CountIf across columns, as an array functions, not concatenated.

carpetony

New Member
Joined
May 26, 2008
Messages
14
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I have one large table, I want to summarize via CountIf, the number of entries in other columns associated to the specific companies.

I need to create the summary table on the fly with VBA, and was hoping to have to input the fewest functions necessary, and was hoping it could do a Vertical and Horizontal Spill of my CountIf functions.

I can create the dynamic list of UNIQUE(Companies) in Column L, and now want to dynamically get the counts of the subsequent columns D thru H. CountIf works with # (hash) to dynamically fill in my values for a single column, but it falters for the subsequent columns. I was wondering if there was something I was missing or could do. I want to leave out to of the columns, and was planning on doing a ChooseCols to omit those, rather than dragging the function or entering it multiple times.

This spill functions works. and I can drag to the right. . .
M2 is =COUNTIFS($B$3:$B$200,$L2#,D$3:D$200,"<>")

However. . .
N2 is =COUNTIFS($B$3:$B$200,$L2#,D$3:H$200,"<>")
Returns #VALUE! errors for the Spill.
Looking at it, I can kind of understand why it doesn't. . .but can't think of anyway to get it to work.

Not the end of the world, this would just be a nice thing, and ended up being a rabbit hole.

Thanks!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try:

Book1
ABCDEFGHIJKLMNOPQ
1UniqueHeader1Header2Header3Header4Header5
2ListHeader1Header2Header3Header4Header5A22221
3A12232B01110
4B431C22111
5C36
6A4871
7B
8C6121398
9
Sheet4
Cell Formulas
RangeFormula
L2:L4L2=UNIQUE(B3:B8)
M2:Q4M2=COUNTIFS(B3:B8,L2#,OFFSET(D3:D8,0,{0,1,2,3,4}),"<>")
Dynamic array formulas.


In the array constant {0,1,2,3,4}, you can pick the columns you want (0 is the first column). You can also do this with the BYCOL function, but someone else will need to show you how to do that.
 
Upvote 1
Solution

Forum statistics

Threads
1,215,069
Messages
6,122,958
Members
449,096
Latest member
Anshu121

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