Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to calculate number of months between 2 dates

Status
Not open for further replies.

sprog

IS-IT--Management
Sep 12, 2002
48
NZ
Hi there
I am trying to put a simple formula into my worksheet to say:

If the number of months between cell A2 and 1st Jan 07 are greater than or equal to 4, then "Yes", else "No".

Could anybody help me with this please.

Thanks
Julie
 
=OR(condition1,condition2)
will give a result of "true" if either condition is true or "False" if both conditions are false

So use =If([red]OR(Mydate=<1Sept2006,Mydate>=1May2007)[/red],"Yes","No")

Dates are held in Excel as numbers. And the above won't quite work as written.
The easiest way to specify 1Sept2006 is to enter it into another cell and then refer to that cell in your OR formula.

If([red]OR(Mydate=<$A$1,Mydate>=$A$2)[/red],"Yes","No")


Gavin
 
I will say what I always say for this type of question - what is a "month" ?? given that they can vary between 28 and 31 days, what exactly is it you are measuring ?

If you just want to know how many times the same day of the month has passed then you are ok but if you are working on anything like SLAs, 4 months could be = 120 days or up to 123 days......

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
I just basically need to know if an employee has been with us for 4 months or more, then they will be entitled to a discount scheme we have.

I have their start date. So need to ask if the difference between their start date and 1st of Jan 07 is 4 or more months, then "Yes" else "No".

I managed to get the number of months, using the Datedif function, but can't seem to incorporate this with the rest of my question?

Thanks
Julie
 
=IF(your datedif function>3,"yes","no")

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 


[TT]
=if((Today()-StartDate)/(365.25/12)>4,"yes","no")
[/TT]


Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top