COUNTING # OF PEOPLE IN LOCATIONS FROM LISTED NAMES

Newbienew

Active Member
Joined
Mar 17, 2017
Messages
395
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I am looking to use a table that has people's names listed next to their locations. At the top, there is a selection box to select the area where the name member is located. From there, I want to calculate everyone in those location that has a cell filled in cell b5. Then non blanks in b6, totals in the B7. I attempted to nest a countifs index match formula but ended up crying. Please help

Project index countif.xlsx
BCDEFGH
4Westselection
5blanks
6non-blanks
7total
8name 1West
9name 2East
10name 3North
11name 4South
12name 11name 5North
13name 2name 6South
14name 31name 7East
15name 4name 8East
16name 51name 9West
17name 61
18name 7
19name 81
20name 91
21name 11
22name 21
23name 31
24name 41
25name 5
26name 6
27name 7
28name 81
29name 91
30name 1
31name 2
32name 31
33name 41
34name 5
35name 61
36name 7
37name 8
38name 91
39name 11
40name 2
41name 3
42name 41
43name 5
44name 6
45name 71
46name 8
47name 9
48name 11
Sheet1
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
New Let's get the ball rollin. We have to start somewhere so this is my solution to your problem. Now I know you didn't ask for a program but let's see if you can use this. If you have problems or questions let us know. Sometimes the A plus students weigh in and give us their solutions which are always better than mine. So let the discussion begin.

VBA Code:
Sub Prog1()

Dim LastCel As Integer
Dim count1 As Integer
Dim count2 As Integer

LastCel = Cells(Rows.Count, "B").End(xlUp).Row

count1 = 0
count2 = 0

For i = 8 To 16

    If Range("B4") = Cells(i, 8) Then

        For a = 12 To LastCel

            If Cells(a, 2) = Cells(i, 7) Then
                count1 = Cells(a, 4) + count1
                count2 = count2 + 1
            End If
        Next a
    End If

Next i
Range("B5") = count2 - count1
Range("B6") = count1
Range("B7") = count2
Range("B5").Select

End Sub

23-09-30 work 1.xlsm
BCDEFGH
4WestselectionNorth
52blanksSouth
67non-blanksEast
79totalWest
8name 1West
9name 2East
10name 3North
11name 4South
12name 11name 5North
13name 2name 6South
14name 31name 7East
15name 4name 8East
16name 51name 9West
17name 61
18name 7
19name 81
20name 91
21name 11
22name 21
23name 31
24name 41
25name 5
26name 6
27name 7
28name 81
29name 91
30name 1
31name 2
32name 31
33name 41
34name 5
35name 61
36name 7
37name 8
38name 91
39name 11
40name 2
41name 3
42name 41
43name 5
44name 6
45name 71
46name 8
47name 9
48name 11
Data
 
Upvote 0
How about using helper columns and COUNTIFS.

Book1.xlsx
ABCDEFGH
1Southselection
23blanks
35non-blanks
48total
5name 1West
6name 2East
7name 3North
8name 4South
9name 11name 5North
10name 2name 6South
11name 31name 7East
12name 4name 8East
13name 51name 9West
14name 61
15name 7count non-blankscount-blanks
16name 81 00
17name 9100
18name 1100
19name 21name 431
20name 3100
21name 41name 622
22name 500
23name 600
24name 700
25name 81
26name 91
27name 1
28name 2
29name 31
30name 41
31name 5
32name 61
33name 7
34name 8
35name 91
36name 11
37name 2
38name 3
39name 41
40name 5
41name 6
42name 71
43name 8
44name 9
45name 11
Newbienew
Cell Formulas
RangeFormula
A2A2=SUM(H16:H24)
A3A3=SUM(G16:G24)
A4A4=SUM(A2:A3)
F16:F24F16=IF(G5:G13=A1,F5:F13,"")
G16:G24G16=COUNTIFS($A$9:$A$45,F16,$C$9:$C$45,1)
H16:H24H16=COUNTIFS($A$9:$A$45,F16,$C$9:$C$45,"")
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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