Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

Excel counting month difference

Posted on 2012-03-23
Medium Priority
204 Views
Hey experts,

I have a Excel like:

join date      Jan 2009  Feb 2009 ........Mar 2012
2008/1/5          1               1                           1
2010/4/10                                                      1

formula inside =if(or(month(a2)<=month(b2), year(a2)<year(b2)),1,"")

that is, if the column heading date is larger than join date, 1 will be shown. and it works well

now I would like in another worksheet in same setting to set if the column heading date > join date for 6 months, 1 will be shown, else is ""

I try many times but fail........help...................
0
Question by:hkgal
[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

LVL 12

Expert Comment

ID: 37758200

=IF(SUMPRODUCT(--(OFFSET(I1,0,-6,1,6)>\$A\$2))=6,1,"")

Kyle
0

LVL 81

Accepted Solution

byundt earned 2000 total points
ID: 37759647
You might try a formula like:
=IF((MONTH(B\$1)+12*YEAR(B\$1) - MONTH(\$A3)-12*YEAR(\$A3))>5,1,"")

This formula counts partial months as full months. For example, if hire date is December 28, 2011, then there will be two months of service in January 2012.

If instead you want to consider partial months as not the same as full months, then try using a DATEDIF formula like:
=IF(\$A2>B\$1,"",IF(DATEDIF(\$A2,B\$1,"m")>=6,1,""))

The sample workbook shows results for the case of row 1 being month beginning dates and also month ending dates.
Month-differenceQ27646260.xlsx
0

Author Closing Comment

ID: 37760332
very good!
0

Featured Post

Question has a verified solution.

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

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!
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns overâ€¦
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Suggested Courses
Course of the Month12 days, 6 hours left to enroll