Solved

Excel - Calculation On Dates

Posted on 2014-01-30
8
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 50

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

756 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