Using COUNTIF on table but not counting correctly??

SNA400

Board Regular
Joined
Nov 5, 2010
Messages
51
HI All

Please bear with me on the description - a bit long winded.

I have 5 tables for the different groups in our company which we use to track holidays and I am using COUNTIF to reference the persons name on each table to tally number of days each person has off.
The issue I am having is the formula is not counting those cells where there are two names in the cell for days where two people are off.

(COUNTIF('Team Leaders'!$B$2:$M$33,M2) where M2 is the employee name and B2:M33 are the calendar cell references - the same on each table

Two names in the cell are set as "EmployeeA/EmployeeB"

I have tried using a generic to see if it will work but still no joy

Is there some way to count these or separate them within the cell to allow them to count correctly?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Maybe with wildcards:
Excel Formula:
=(COUNTIF('Team Leaders'!$B$2:$M$33,"*" & M2 & "*")
 
Upvote 0
Maybe with wildcards:
Excel Formula:
=(COUNTIF('Team Leaders'!$B$2:$M$33,"*" & M2 & "*")
I would be wary of that as it could be that a short name is also part of a longer name as in my sample below. That formula returns 5 for Fred when it should only be 3.

@SNA400
I suggest that you update your Account details (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’)

Possibly this?

22 12 15.xlsm
BCD
2Fred
3TomFred/Tom
4Tom/Alfred
5AlfredFred/Alfred/Ken
6Tom
7
Team Leaders


22 12 15.xlsm
MN
1NameCount
2Fred3
3Alfred3
4Tom4
5Ken1
Count
Cell Formulas
RangeFormula
N2:N5N2=COUNT(SEARCH("/"&M2&"/","/"&'Team Leaders'!B$2:M$33&"/"))
 
Upvote 0
I would be wary of that as it could be that a short name

I made the assumption that the OP would understand that using a short name for a function like this would cause a problem, even if the names were in different cells. Personally i would be looking to restructure the spreadsheet so that each cell would not take more than one entry - this would aid analysis at a later date.
 
Upvote 0
Hi both - sorry, I used the wrong terminology - I said generic instead of wildcard so I was aware of the issue :)

I will give your idea a try Peter and if it works I'll owe you a drink
 
Upvote 0
I will give your idea a try Peter
Hope it works for you. .. but please don't forget this:
@SNA400
I suggest that you update your Account details (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’)
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,085
Members
452,378
Latest member
Hoodzy01

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