I have a sheet with HR info which has a 'start date' column and 'end date' for employees. On a summary page I want to show each month in the year, along with totals for each Type of employee (part time, full time etc) for that month.

Columns:
A - Name
B - Start Date
C - End Date
D - Type of Employee
E - Grade

The query for January (which i'm struggling with) needs to say: Check column D for type=x AND Start date is before Jan 1st, AND End date is NULL OR After 31st Jan. The aim is to show the true total of employees on the payroll that month.

Help please!