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
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

pritcham

Board Regular
Joined
Oct 26, 2005
Messages
128
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
 

Watch MrExcel Video

Forum statistics

Threads
1,118,734
Messages
5,573,910
Members
412,555
Latest member
mark84
Top