Peter said:
When I apply this formula - =EOMNTH(E28,3) - to a date Jan-08 in cell E28
Excel gives me the correct answer Apr-08. When I use the same approach in
an
IF statement it doesn't work. Here's the formula I'm using -
=IF(E28<=$B$78,E28,IF(E28-$B$78<6,EOMONTH(E28,3),E28))
$B$78 is TODAY - Oct-07
Can any body help
The formula does work. I suspect you may not understand Excel dates and how
they calculate.
Excel stores dates as the number of days since 31st December 1899; (that is,
1st Jan 1900 = 1). What you display depends on the formatting you apply. So,
if you format today (26th Oct 2007, or serial number 39381) as mmm-yy, you
display Oct-07. The important point is that formatting doesn't change the
underlying number.
Now because the dates are stored thus (number of days since 31st December
1899), when you do arithmetic, you are calculating in days. Even if you are
displaying only month/year, the calculation is still in days. So the
difference between your date in Jan 2008 and today is (much) greater than 6.
If you want to calculate the difference in months, you need to extract
information from your date cells (using YEAR(E28), MONTH(E28), etc.) and
incorporate this into your formula.