?
Solved

Excel counting month difference

Posted on 2012-03-23
3
Medium Priority
?
202 Views
Last Modified: 2012-03-24
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
Comment
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
  • Learn & ask questions
3 Comments
 
LVL 12

Expert Comment

by:kgerb
ID: 37758200
How about this?  My join date starts in A2 and my column headings start in B1.

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

Kyle
0
 
LVL 81

Accepted Solution

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

by:hkgal
ID: 37760332
very good!
0

Featured Post

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.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

752 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