#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 349
Default Manipulating dates

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default Manipulating dates

It's not the same approach

E28-$B$78<6

that part compares the days, are you really asking if E28-today() is less
than 6 days, that means that
if you have 01/01/08 in E28 it will be FALSE and the result should be E28.
It looks to me if you want to check months and not days so that means this
formula might work

=IF(E28<=TODAY(),E28,IF(DATEDIF(TODAY(),E28,"m")<6 ,EOMONTH(E28,3),E28))


note that you can skip the B78 altogether and use TODAY() instead


also note that EOMONTH returns end of the month 3 months after, if you want
3 months after look at EDATE in help

EDATE(E28,3)

and if the date in E28 is Jan 1 2008 it will return Apr 1 2008


--


Regards,


Peo Sjoblom


"Peter" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 364
Default Manipulating dates

"Peter" wrote in message
...
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.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 349
Default Manipulating dates



"Peter" wrote:

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


Thank you. I stupidly forgot the answer was in days. By changing the 6 to
180 I got the right answer.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,440
Default Manipulating dates

Hi Peter,

I hope you realize that that is a rather inaccurate solution :-)

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Peter" wrote in message ...
|
|
| "Peter" wrote:
|
| 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
|
| Thank you. I stupidly forgot the answer was in days. By changing the 6 to
| 180 I got the right answer.
|




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default Manipulating dates

Not necessarily, 180 days is approximate for instance 180 days added to Jul
1 07 will return 12/28/07

with 07/01/07 in A1

=A1+180

returns 12/28/07

whereas

=DATE(YEAR(A1),MONTH(A1)+6,DAY(A1))

returns 01/01/08



--


Regards,


Peo Sjoblom



"Peter" wrote in message
...


"Peter" wrote:

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


Thank you. I stupidly forgot the answer was in days. By changing the 6 to
180 I got the right answer.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Manipulating a two-axis graph. FTD Charts and Charting in Excel 4 October 12th 07 11:46 PM
manipulating dates ghostinhawaii Excel Worksheet Functions 2 March 24th 07 05:16 AM
Manipulating dates (was Add 6 months to a date) Bill Ridgeway New Users to Excel 2 March 31st 06 07:46 PM
manipulating columns GISDude Charts and Charting in Excel 0 March 1st 06 10:40 PM
Manipulating shapes thePriest Excel Discussion (Misc queries) 0 April 20th 05 06:41 PM


All times are GMT +1. The time now is 09:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"