Comparing Dates and Identifying Employees

kgun12

New Member
Joined
Dec 24, 2016
Messages
12
NameHire DateSeparation DateQualify
Agustin7/16/2014Num
Aldo3/17/20141/21/2018No
Ibrahim1/21/20171/7/2018No
Luis8/2/20179/3/2017No
Issaha9/28/201611/20/2016No
John2/1/20179/5/2017Yes
Arton5/17/2017Num

<tbody>
</tbody>

Hope someone can point me in the right direction. I'm a relative novice with excel but I'm better than the next guy at work so I've been given the simple task of creating a list of employees hired in 2017 that were employed with the firm for more than 90 days and would qualify for certain benefits. Above is a small list taken from a much larger sheet. I've inserted the formula:
IF(AND(ISNUMBER(C2),B2>=DATE(2017,1,1),DATEDIF(EOMONTH(B2,0)+1,C2,"d")>90),"Yes","No")

<tbody>
</tbody>

under the "Qualify" column, it works except when the employee does not have a separation date since they're still employeed with the firm, my formula kicks out a #NUM message. And advice?
 
Thanks Marty.


Always a pleasure....

Not in the office right now. Will report back soon.

No worries...

At least I'm not crazy thinking this is a tough one to crack.

I actually had to draw this one out on a sheet of paper and then put it together....




NB there are TWO formulae here (not both are necessary).



The first one just gives you a Y or an N for whether they qualify or not.

The second does exactly the same thing BUT... it gives you the REASON as well (as you can see in the table below)



Below is your table (date format rearranged for UK dates = DD-MM-YYYY)...

PLUS

some test data that should cover all criteria / variations / error trapping.

I even added in a check to "only do this calculation if there is a HIRE DATE in the first place"...!


Let me know how you get on...




Excel 2010
ABCDE
1NameHire DateSeparation DateQualifyQualify with Reason
2Agustin16/07/2014NN : Did not start in 2017
3Aldo17/03/201421/01/2018NN : Did not start in 2017
4Ibrahim21/01/201707/01/2018YY : Separated>90
5Luis02/08/201703/09/2017NN :Separated<90
6Issaha28/09/201620/11/2016NN : Did not start in 2017
7John01/02/201705/09/2017YY : Separated>90
8Arton17/05/2017YY : Still Emp and >90
9
10Ibrahim21/01/2017YY : Still Emp and >90
11Ibrahim21/01/201707/01/2018YY : Separated>90
12
13Hire DateSeparation DateQualifyQualify with Reason
14Test Name 101/01/2018NN : Did not start in 2017
15Test Name 215/12/2017NN : Still Emp < 90d
16Test Name 312/11/2017NN : Still Emp < 90d
17Test Name 405/10/2017YY : Still Emp and >90
18Test Name 501/01/201830/01/2018NN : Did not start in 2017
19Test Name 615/12/201731/01/2018NN :Separated<90
20Test Name 712/11/201701/02/2018NN :Separated<90
21Test Name 805/10/201702/02/2018YY : Separated>90
22Test Name 901/01/2016NN : Did not start in 2017
23Test Name 1015/12/2016NN : Did not start in 2017
24Test Name 1112/11/2016NN : Did not start in 2017
25Test Name 1205/10/2016NN : Did not start in 2017
26Test Name 1301/01/201630/01/2018NN : Did not start in 2017
27Test Name 1415/12/201631/01/2018NN : Did not start in 2017
28Test Name 1512/11/201601/02/2018NN : Did not start in 2017
29Test Name 1601/01/201730/01/2017NN : SepDate<nmdate< td=""></nmdate<>

<tbody>
</tbody>
FINAL

Worksheet Formulas
CellFormula
D2=IF(<font color="Blue">B2>0,IF(<font color="Red">AND(B2>=DATE(2017,1,1),B2<=DATE(2017,12,31)),IF(C2>0,IF(C2<eomonth(B2,0DATEDIF(EOMONTH(B2,0)+1,C2,"d")>90,"Y","N"</eomonth()),IF(DATEDIF(EOMONTH(B2,0)+1,TODAY(),"d")>90,"Y","N")),"N"),"")
E2=IF(<font color="Blue">B2>0,IF(<font color="Red">AND(B2>=DATE(2017,1,1),B2<=DATE(2017,12,31)),IF(C2>0,IF(C2<eomonth(B2,0DATEDIF(EOMONTH(B2,0)+1,C2,"d")>90,"Y : Separated>90","N :Separated<90"),IF(DATEDIF(EOMONTH(B2,0)+1,TODAY(),"d")>90,"Y : Still Emp and >90","N : Still Emp < 90d")</eomonth(),"N : Did not start in 2017"),"")

<tbody>
</tbody>

<tbody>
</tbody>


Seems to be a problem with the HTML.. ignore the above formulae... its a formatting problem, not a formulae problem.

Code:
=IF(B2 > 0,IF(AND(B2 >= DATE(2017,1,1),B2 <= DATE(2017,12,31)),IF(C2 > 0,IF(C2 < EOMONTH(B2,0)+1,"N",IF(DATEDIF(EOMONTH(B2,0)+1,C2,"d") > 90,"Y","N")),IF(DATEDIF(EOMONTH(B2,0)+1,TODAY(),"d") > 90,"Y","N")),"N"),"")


=IF(B2 > 0,IF(AND(B2 >= DATE(2017,1,1),B2 <= DATE(2017,12,31)),IF(C2 > 0,IF(C2 < EOMONTH(B2,0)+1,"N : SepDate < NMDate",IF(DATEDIF(EOMONTH(B2,0)+1,C2,"d") > 90,"Y : Separated > 90","N : Separated < 90")),IF(DATEDIF(EOMONTH(B2,0)+1,TODAY(),"d") > 90,"Y : Still Emp and  > 90","N : Still Emp  <  90d")),"N : Did not start in 2017"),"")
 
Last edited:
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
This might help.

https://www.dropbox.com/s/ab7p3q70zc5d2r0/EOMonthQualifyProblem.xlsx?dl=0


(you'll want the third sheet called FINAL)

Marty, thank you so much.

This was what I wrote up last night:

IF(B2>DATE(2017,1,1),IF(ISNUMBER(C2),IF(DATEDIF(EOMONTH(B2,0)+1,C2,"D")>90,"YES","No"),IF(AND(B2>DATE(2017,1,1),DATEDIF(B2,TODAY(),"D")>90),"Yes","No")))

Anything before 2016 would pop up false, anything after 2017 would be #Num . Your solution does the trick, thanks again for putting in time to help me, greatly appreciate it.
 
Upvote 0

Forum statistics

Threads
1,217,391
Messages
6,136,321
Members
450,005
Latest member
BigPaws

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