Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel - Calculation On Dates

Posted on 2014-01-30
8
Medium Priority
?
274 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 2000 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 52

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

715 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