unique records by team

juster21

Well-known Member
Joined
Jun 3, 2005
Messages
867
All,
I have a table with team names, employee ID, month/year combos and a quality score.
I need to calculate the total count of employees that have a quality score within a specified timeframe (March 2009) and have the results by team name.

See example:
Team EmpID MonthYear Quality
A.......1.......March2009.....99
A.......2.......March2009.....98
A.......3.......March2009
A.......4.......March2009.....100

B.......5.......March2009.....100
B.......6.......March2009.....99
B.......7.......March2009

Results:
A = 3
B = 2
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Code:
select
Team, count(*)
from your_table
where
(
  (  
    [Year] = 2009
  )
  and
  ( 
    [Month] = 'March'
  )
  and 
  (
    Quality is not null
  )
)
group by 
Team
 
Upvote 0
MonthYear is one column ?
what's in the Quality column is there is no Quality ?
null ? 0 ?

this works for me if Quality is null when no Quality is entered
Code:
select
Team, count(*)
from your_table
where
(
  (  
    MonthYear = 'March2009'
  )
  and 
  (
    Quality is not null
  )
)
group by 
Team
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,496
Members
449,089
Latest member
Raviguru

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