Question on using DateDiff in a query with more than one criteria

Joined
Sep 24, 2014
Messages
2

Employee Hire & Termination Dates

Rick worked from 08/07/13 until 12/07/13
Jane worked from 02/03/14 until 09/03/14
Tom worked from 08/01/14 until 09/01/14

My report needs to reflect the number of weeks each employee worked between specific dates, 08/28/13 through 08/28/14.
I know that I can add DateDiff("ww",#08/28/13#,#08/28/14#) to my query to determine the number of weeks between my given dates but I don't how to apply that to each full period of employment.

Help is much appreciated
:confused:
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Your query would ask for:
[emp], [Hire], [Term] , Weeks:DateDiff("ww", [Hire],[Term]) where [hire] >= 08/28/13 and [term] <=08/28/14,
 
Upvote 0
Thank you very much for your assistance. I'm not sure what I'm doing incorrectly, I keep getting a syntax error. Below is my expression, the "DOT" and "DOH" are the actual field names for the hire and term fields in my database. It highlights the "where" in my expression after the syntax error but I am having difficulty figuring out what to do with it.

Weeks:DateDiff("ww", [DOH],[DOT]) where [DOH] >= 08/28/13 and [DOT] <=08/28/14)
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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