Tying to pull only dates between two given dates

sellis

New Member
Joined
May 17, 2011
Messages
33
I am trying to only pull records that are between 04/01/2011 and 05/31/2011. I have access 2007, and here is my current code.

Days Worked: IIf([Emp Date]![Term Date]>#4/1/2011# Or [Emp Date]![Term Date]<#5/31/2011#,IIf([Emp Date]![Rehire Date] Is Not Null,DateDiff("d",[Emp Date]![Rehire Date],"5/31/2011"),DateDiff("d",[Emp Date]![Hire Date],"05/31/2011")),Null)

I have been testing and adding slowly, and everything worked until I added the extra part to pull anything greater than 04/01/2011. Any ideas how to fix this would be great. The resoluts no longer separate anything at all and at least it used to pull only the stuff before 05/31. Thanks
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
You seem to be doing a little more than pulling records between 2 dates.

If that's all you wanted to do you could use this.

[Emp Date] Between #4/01/2011# And #05/31/2011#

By the way your logic isn't quite right for the first part, it should be And not Or.

With Or you will be pulling all records after 4/01/2011 and all records before 05/31/2011.

That's basically all records.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,728
Members
452,939
Latest member
WCrawford

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