Dynamic Range Countif

SonnyKali

New Member
Joined
Dec 6, 2017
Messages
2
Hey everyone

I hope someone can help me with the following.

I have a sheet with companies (Column A) and their subsidiaries(Column B) and the country where those sub sidiariesoperate (Column C). It looks something like this:

Company
Subsidiary
Location
Company 1
A
US
Company 1
B
JP
Company 1
C
CH
Company 2
D
FR
Company 3
E
JP
Company 3
F
JP
Company 4
G
FR
Company 4
H
US
Company 4
I
UK
Company 4
J
UK
Company 4
K
UK
Company 5
L
UK
Company 5
M
US
Company 5
N
US
Company 5
O
US

<tbody>
</tbody>


I use the COUNTIF function to determine the number of subsidaries per company withiin a given country. I do this by manually adjusting the range within the COUNTIF function. Is there a more easy way do this, by automatically determining the range per company. So as in the example, in the case of company 1 range A2:A4, company 2 A5, company 3 A6:A7, and so on.

Thanks in advance!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
A
B
C
D
E
G
H
I
J
K
L
1
Company 1AUSJPCHFRUKUS
2
Company 1BJPCompany 1
1​
1​
0​
0​
1​
3
Company 1CCHCompany 2
0​
0​
1​
0​
0​
4
Company 2DFRCompany 3
2​
0​
0​
0​
0​
5
Company 3EJPCompany 4
0​
0​
1​
3​
1​
6
Company 3FJPCompany 5
0​
0​
0​
1​
3​
7
Company 4GFR
8
Company 4HUS
9
Company 4IUK
10
Company 4JUK
11
Company 4KUK
12
Company 5LUK
13
Company 5MUS
14
Company 5NUS
15
Company 5OUS

<tbody>
</tbody>

g2=COUNTIFS($A$1:$A$15,$E2,$C$1:$C$15,G$1) copy across and down

 
Upvote 0

Forum statistics

Threads
1,215,510
Messages
6,125,234
Members
449,216
Latest member
biglake87

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