Counting a list of wild cards from a range of cells

BeccaB131

New Member
Joined
May 31, 2018
Messages
11
Good Evening All

Was wondering if anybody had a solution.

I use a labour diary: Where Emp 1 to 9 are typed as First name and initial ie Emp 1 = Becca R, Emp 2 = John D etc but have made anonymous for this request. So we enter everyone on site (b1-j14) and use a count if table to ensure no one is missed using the (b17-i25)- we also add others in that are not listed in B17 to B25 - is there a way to count all the wild cards from B17-B25 in each row (2-14) i tried: in cell A2'=countif(C2:I2,"*"&$B$17:$B$25&"*") and =countif(C2:I2,"*"&$B$17&"*":"*"&$B$25&"*") neither of which seems to work - wanted it to = 12 as excludes the 'Other 1' as not in the wild card list B17-25

Many thanks in advance if anyone does have a solution :)

ABCDEFGHI
1​
Day1Day2Day3Day4Day5Day6Day7
2​
LOCATION1Emp 1, Emp 2, Emp 3, Other 1Emp 1, Emp 2, Emp 3, Other 1Emp 1, Emp 2, Emp 3, Other 1Emp 1, Emp 2, Emp 3, Other 1
3​
LOCATION2Emp 4Emp 4Emp 4Emp 4Emp 4Emp 4Emp 4
4​
LOCATION3Emp 1, Emp 2, Emp 3, Other 1
5​
LOCATION4Emp 5, Emp 7, Emp 8Emp 5, Emp 7, Emp 9Emp 5, Emp 7,
6​
LOCATION5Other 1, Other1Emp 1, Emp 2, Emp 3, Other 1
7​
LOCATION6
8​
LOCATION7Emp 5, Emp 7Emp 5, Emp 8Emp 5, Emp 9Emp 5,
9​
LOCATION8
10​
LOCATION9Other 2, Other 5Other 2, Other 6Other 2, Other 7Other 2, Other 8Other 2, Other 9Other 2, Other 10Other 2, Other 11
11​
LOCATION10Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4Emp 1, Emp 2, Emp 3, Other 1,Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4
12​
LOCATION11Emp 6, Other 3, Other 4
13​
LOCATION12
14​
LOCATION13
15​
16​
17​
Emp 1
1​
1​
1​
1​
1​
1​
1​
18​
Emp 2
1​
1​
1​
1​
1​
1​
1​
19​
Emp 3
1​
1​
1​
1​
1​
1​
1​
20​
Emp 4
1​
1​
1​
1​
1​
1​
1​
21​
Emp 5
1​
1​
1​
1​
1​
1​
1​
22​
Emp 6
1​
1​
1​
1​
1​
1​
1​
23​
Emp 7
1​
1​
1​
1​
0​
0​
0​
24​
Emp 8
1​
0​
0​
0​
1​
0​
0​
25​
Emp 9
0​
1​
0​
0​
0​
1​
0​
26​


Same table showing formulas
ABCDEFGHI
1Day1Day2Day3Day4Day5Day6Day7
2LOCATION1Emp 1, Emp 2, Emp 3, Other 1Emp 1, Emp 2, Emp 3, Other 1Emp 1, Emp 2, Emp 3, Other 1Emp 1, Emp 2, Emp 3, Other 1
3LOCATION2Emp 4Emp 4Emp 4Emp 4Emp 4Emp 4Emp 4
4LOCATION3Emp 1, Emp 2, Emp 3, Other 1
5LOCATION4Emp 5, Emp 7, Emp 8Emp 5, Emp 7, Emp 9Emp 5, Emp 7,
6LOCATION5Emp 1, Emp 2, Emp 3, Other 1
7LOCATION6
8LOCATION7Emp 5, Emp 7Emp 5, Emp 8Emp 5, Emp 9Emp 5,
9LOCATION8
10LOCATION9Other 2, Other 5Other 2, Other 6Other 2, Other 7Other 2, Other 8Other 2, Other 9Other 2, Other 10Other 2, Other 11
11LOCATION10Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4Emp 1, Emp 2, Emp 3, Other 1,Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4
12LOCATION11Emp 6, Other 3, Other 4
13LOCATION12
14LOCATION13
15
16
17Emp 1=COUNTIF(D$3:D$15,"*"&$C18&"*")=COUNTIF(E$3:E$15,"*"&$C18&"*")=COUNTIF(F$3:F$15,"*"&$C18&"*")=COUNTIF(G$3:G$15,"*"&$C18&"*")=COUNTIF(H$3:H$15,"*"&$C18&"*")=COUNTIF(I$3:I$15,"*"&$C18&"*")=COUNTIF(J$3:J$15,"*"&$C18&"*")
18Emp 2=COUNTIF(D$3:D$15,"*"&$C19&"*")=COUNTIF(E$3:E$15,"*"&$C19&"*")=COUNTIF(F$3:F$15,"*"&$C19&"*")=COUNTIF(G$3:G$15,"*"&$C19&"*")=COUNTIF(H$3:H$15,"*"&$C19&"*")=COUNTIF(I$3:I$15,"*"&$C19&"*")=COUNTIF(J$3:J$15,"*"&$C19&"*")
19Emp 3=COUNTIF(D$3:D$15,"*"&$C20&"*")=COUNTIF(E$3:E$15,"*"&$C20&"*")=COUNTIF(F$3:F$15,"*"&$C20&"*")=COUNTIF(G$3:G$15,"*"&$C20&"*")=COUNTIF(H$3:H$15,"*"&$C20&"*")=COUNTIF(I$3:I$15,"*"&$C20&"*")=COUNTIF(J$3:J$15,"*"&$C20&"*")
20Emp 4=COUNTIF(D$3:D$15,"*"&$C21&"*")=COUNTIF(E$3:E$15,"*"&$C21&"*")=COUNTIF(F$3:F$15,"*"&$C21&"*")=COUNTIF(G$3:G$15,"*"&$C21&"*")=COUNTIF(H$3:H$15,"*"&$C21&"*")=COUNTIF(I$3:I$15,"*"&$C21&"*")=COUNTIF(J$3:J$15,"*"&$C21&"*")
21Emp 5=COUNTIF(D$3:D$15,"*"&$C22&"*")=COUNTIF(E$3:E$15,"*"&$C22&"*")=COUNTIF(F$3:F$15,"*"&$C22&"*")=COUNTIF(G$3:G$15,"*"&$C22&"*")=COUNTIF(H$3:H$15,"*"&$C22&"*")=COUNTIF(I$3:I$15,"*"&$C22&"*")=COUNTIF(J$3:J$15,"*"&$C22&"*")
22Emp 6=COUNTIF(D$3:D$15,"*"&$C23&"*")=COUNTIF(E$3:E$15,"*"&$C23&"*")=COUNTIF(F$3:F$15,"*"&$C23&"*")=COUNTIF(G$3:G$15,"*"&$C23&"*")=COUNTIF(H$3:H$15,"*"&$C23&"*")=COUNTIF(I$3:I$15,"*"&$C23&"*")=COUNTIF(J$3:J$15,"*"&$C23&"*")
23Emp 7=COUNTIF(D$3:D$15,"*"&$C24&"*")=COUNTIF(E$3:E$15,"*"&$C24&"*")=COUNTIF(F$3:F$15,"*"&$C24&"*")=COUNTIF(G$3:G$15,"*"&$C24&"*")=COUNTIF(H$3:H$15,"*"&$C24&"*")=COUNTIF(I$3:I$15,"*"&$C24&"*")=COUNTIF(J$3:J$15,"*"&$C24&"*")
24Emp 8=COUNTIF(D$3:D$15,"*"&$C25&"*")=COUNTIF(E$3:E$15,"*"&$C25&"*")=COUNTIF(F$3:F$15,"*"&$C25&"*")=COUNTIF(G$3:G$15,"*"&$C25&"*")=COUNTIF(H$3:H$15,"*"&$C25&"*")=COUNTIF(I$3:I$15,"*"&$C25&"*")=COUNTIF(J$3:J$15,"*"&$C25&"*")
25Emp 9=COUNTIF(D$3:D$15,"*"&$C26&"*")=COUNTIF(E$3:E$15,"*"&$C26&"*")=COUNTIF(F$3:F$15,"*"&$C26&"*")=COUNTIF(G$3:G$15,"*"&$C26&"*")=COUNTIF(H$3:H$15,"*"&$C26&"*")=COUNTIF(I$3:I$15,"*"&$C26&"*")=COUNTIF(J$3:J$15,"*"&$C26&"*")
26
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
With Power Query
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Location"}, "Attribute", "Value"),
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Unpivoted Other Columns", {{"Value", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Value"),
    #"Trimmed Text" = Table.TransformColumns(#"Split Column by Delimiter",{{"Value", Text.Trim, type text}}),
    #"Grouped Rows" = Table.Group(#"Trimmed Text", {"Value", "Attribute"}, {{"Count", each Table.RowCount(_), Int64.Type}}),
    #"Sorted Rows" = Table.Sort(#"Grouped Rows",{{"Value", Order.Ascending}}),
    #"Pivoted Column" = Table.Pivot(#"Sorted Rows", List.Distinct(#"Sorted Rows"[Attribute]), "Attribute", "Count"),
    #"Reordered Columns" = Table.ReorderColumns(#"Pivoted Column",{"Value", "Day1", "Day2", "Day3", "Day4", "Day5", "Day6", "Day7"})
in
    #"Reordered Columns"

Book4
BCDEFGHIJK
2LocationDay1Day2Day3Day4Day5Day6Day7
3LOCATION1Emp 1, Emp 2, Emp 3, Other 1Emp 1, Emp 2, Emp 3, Other 1Emp 1, Emp 2, Emp 3, Other 1Emp 1, Emp 2, Emp 3, Other 1
4LOCATION2Emp 4Emp 4Emp 4Emp 4Emp 4Emp 4Emp 4
5LOCATION3Emp 1, Emp 2, Emp 3, Other 1
6LOCATION4Emp 5, Emp 7, Emp 8Emp 5, Emp 7, Emp 9Emp 5, Emp 7,
7LOCATION5Other 1, Other1Emp 1, Emp 2, Emp 3, Other 1
8LOCATION6
9LOCATION7Emp 5, Emp 7Emp 5, Emp 8Emp 5, Emp 9Emp 5,
10LOCATION8
11LOCATION9Other 2, Other 5Other 2, Other 6Other 2, Other 7Other 2, Other 8Other 2, Other 9Other 2, Other 10Other 2, Other 11
12LOCATION10Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4Emp 1, Emp 2, Emp 3, Other 1,Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4Emp 6, Other 3, Other 4
13LOCATION11Emp 6, Other 3, Other 4
14
15ValueDay1Day2Day3Day4Day5Day6Day7
1611
17Emp 11111111
18Emp 21111111
19Emp 31111111
20Emp 41111111
21Emp 51111111
22Emp 61111111
23Emp 71111
24Emp 811
25Emp 911
26Other 11211111
27Other 101
28Other 111
29Other 21111111
30Other 31111111
31Other 41111111
32Other 51
33Other 61
34Other 71
35Other 81
36Other 91
37Other11
Sheet1


Note that Other1<>Other 1
 
Upvote 0
Thanks - was wanting to exclude all the 'other' and count only the wild cards listed - as a example emp = an employee and other = a subcontractor company and not an individual - I want to count the total number of employees on location 1 (which would be 12) then location 2 (which would be 7) then location 3, 4 to 11 - thanks
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also in what way did the formula you posted not work?
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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