Date Expression in Query

Smurfit-Stone

Active Member
Joined
Dec 1, 2004
Messages
485
Hello, I have a dbase with employee info. I have a field called HireDate. Currently a query prompts the user for a month (e.g. 1,2,3, or Jan. Feb or Mar.) and it displays the results ( all the employees hired in that month). I now need an expression that will tell me how many years the employee has worked. It should use the current date and subtract the Hire Date, thus giving me years of service. example say, a person's Hire Date was 11/29/1998 and today is 12/1/2005, I would like to see a result of 7 years of service......Thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi

Something like the following should do the trick for you:

Years_Of_Service: DateDiff("yyyy",[HireDate],Now())

Where [HireDate] is your field that stores when they started.

Martin
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,044
Members
449,063
Latest member
ak94

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