Solved

Excel - Calculation On Dates

Posted on 2014-01-30
8
251 Views
Last Modified: 2014-01-30
Hello,

I'm trying to come up with a formula that will look at a hire date and end of year date.  If the total months exceeds 9 months, then the statement is true.  Less than 9 months the statement is false.  For example, an employee is hired 08/15/2013 and the end of year date is 12/31/2013.  Since the total time of employment is less than 9 months the statement would be false.

Any recommendations?
0
Comment
Question by:Escanaba
8 Comments
 
LVL 19

Expert Comment

by:Ken Butters
ID: 39820934
there are probably a lot of ways to do this..

1)  use the analysis toolpak described here: http://office.microsoft.com/en-us/excel-help/edate-HP005209073.aspx   This would allow you to subtract 9 months from the end of year date, and compare it to your hire date to see which is greater.

2) compare your hire date to March 31 of the current year.  If the hire date is less than march 31 of the current year... then you would have value of true.
0
 
LVL 22

Accepted Solution

by:
spattewar earned 500 total points
ID: 39820961
Hi,

How about using the datedif() formula in excel?

=IF(datedif(earlierdate,laterdate,"m")>8,TRUE,FALSE")

What would you want if the employment is exactly 9 months?

hope it helps.
0
 
LVL 48

Expert Comment

by:Rgonzo1971
ID: 39820967
Hi,

Attention if the person is hired April 1st is True or False then you have to compare accordingly

Regards
0
 
LVL 19

Expert Comment

by:Ken Butters
ID: 39821025
@spattewar   Note : the only reason I would probably try to avoid Datedif is because it doesn't handle the calculation properly when the later month has fewer days in it that the earlier month.

For example... April has 30 days, and January has 31 days.

If you do a datedif on those to dates the result will be 2.  However January 31 to April 30 is 3 months not 2.  

In this case when we are using end of year, you would be ok because the later date happens to be December 31, and you never have more than 31 days in a month... but at any rate it is something to be aware of when you do date calculations.  

That is what the EDATE from the analysis tookpak corrects.

If exactly 9 months is an issue one way or another, then you can always adjust by one day as necessary.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 22

Expert Comment

by:spattewar
ID: 39821086
Yes Ken. That is correct but it would work in this scenario. Thanks for putting the information.
0
 
LVL 9

Expert Comment

by:Christopher Jay Wolff
ID: 39821232
Hi all.


Would it be good to use the YEARFRAC function?  In Office 2013 it looks like this from the help file, and I added my own data in column G to test it.  There are remarks in the help file stating the function YEARFRAC may not work properly with dates entered as text, yet it appears that is what they did in the example.  I at least formatted my date cells in column G to be date format and it seems to work.

Here is how it looks showing 9 month IF statement...
Excel screen grab of YEARFRAC1

and here it is showing YEARFRAC function...
Excel screen grab of YEARFRAC2
0
 
LVL 3

Expert Comment

by:ola_erik
ID: 39821430
The number of days of nine months are

2009-01-25      2009-10-25      273
2009-02-25      2009-11-25      273
2009-03-25      2009-12-25      275
2009-04-25      2010-01-25      275
2009-05-25      2010-02-25      276
2009-06-25      2010-03-25      273
2009-07-25      2010-04-25      274
2009-08-25      2010-05-25      273
2009-09-25      2010-06-25      273
2009-10-25      2010-07-25      273
2009-11-25      2010-08-25      273
2009-12-25      2010-09-25      274
(2009 was a non-leap year.)

the third column is the simple subtraction between the first two giving the number of days.

=(A2-A1)

It means anyone employed for 272 or less days does not have 9 months
Anyone employed 276 or more days are always employed for at least 9 months.

What to do with the ones with 273-275 days? If it's a legal framework talking about nine months it often have this defined, ask them.

Sometimes calculations are done with 30 day months only, which would mean 270 days.

So, use 270 or 272 days as a limit and clear it with whoever is responsible for policy.

so:
emp date    EOY date    =(B1-A1)>269
0
 
LVL 1

Author Closing Comment

by:Escanaba
ID: 39821450
This will work.  Thank you.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now