+ Reply to Thread
Results 1 to 4 of 4

Adding months to dates should account for 28-30-31 day months

  1. #1
    Graham
    Guest

    Adding months to dates should account for 28-30-31 day months

    When working with the DATE function to subtract one month from a given dat,
    using the following string:
    =TEXT(DATE(YEAR(Report_Date),MONTH(Report_Date)-1,DAY(Report_Date)),"mmm yy")
    & " YTD Actual", the formula doesn't fully take account of different length
    months.

    If I use the date 31/10/06 the prior month returned is still October. To
    correct this I have to use 30/10/6 instead, then check each instance of the
    formula to ensure all report headings are correct.

    ----------------
    This post is a suggestion for Microsoft, and Microsoft responds to the
    suggestions with the most votes. To vote for this suggestion, click the "I
    Agree" button in the message pane. If you do not see the button, follow this
    link to open the suggestion in the Microsoft Web-based Newsreader and then
    click "I Agree" in the message pane.

    http://www.microsoft.com/office/comm...heet.functions

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Try

    =TEXT(Report_Date-DAY(Report_Date),"mmm yy")


    ...or if you have Analysis ToolPak installed you can use

    =TEXT(EDATE(Report_Date,-1),"mmm-yy") or
    =TEXT(EOMONTH(Report_Date,-1),"mmm-yy")
    Last edited by daddylonglegs; 02-01-2006 at 05:50 AM.

  3. #3
    Bob Phillips
    Guest

    Re: Adding months to dates should account for 28-30-31 day months

    Try

    =TEXT(MIN(DATE(YEAR(Report_Date),MONTH(Report_Date)-{1,0},(DAY(Report_Date)*
    {1,0}))),"mmm yy")&" YTD Actual"

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Graham" <[email protected]> wrote in message
    news:[email protected]...
    > When working with the DATE function to subtract one month from a given

    dat,
    > using the following string:
    > =TEXT(DATE(YEAR(Report_Date),MONTH(Report_Date)-1,DAY(Report_Date)),"mmm

    yy")
    > & " YTD Actual", the formula doesn't fully take account of different

    length
    > months.
    >
    > If I use the date 31/10/06 the prior month returned is still October. To
    > correct this I have to use 30/10/6 instead, then check each instance of

    the
    > formula to ensure all report headings are correct.
    >
    > ----------------
    > This post is a suggestion for Microsoft, and Microsoft responds to the
    > suggestions with the most votes. To vote for this suggestion, click the "I
    > Agree" button in the message pane. If you do not see the button, follow

    this
    > link to open the suggestion in the Microsoft Web-based Newsreader and then
    > click "I Agree" in the message pane.
    >
    >

    http://www.microsoft.com/office/comm...heet.functions



  4. #4
    Ron Rosenfeld
    Guest

    Re: Adding months to dates should account for 28-30-31 day months

    On Wed, 1 Feb 2006 01:31:26 -0800, Graham <[email protected]>
    wrote:

    >When working with the DATE function to subtract one month from a given dat,
    >using the following string:
    >=TEXT(DATE(YEAR(Report_Date),MONTH(Report_Date)-1,DAY(Report_Date)),"mmm yy")
    >& " YTD Actual", the formula doesn't fully take account of different length
    >months.
    >
    >If I use the date 31/10/06 the prior month returned is still October. To
    >correct this I have to use 30/10/6 instead, then check each instance of the
    >formula to ensure all report headings are correct.
    >
    >----------------
    >This post is a suggestion for Microsoft, and Microsoft responds to the
    >suggestions with the most votes. To vote for this suggestion, click the "I
    >Agree" button in the message pane. If you do not see the button, follow this
    >link to open the suggestion in the Microsoft Web-based Newsreader and then
    >click "I Agree" in the message pane.
    >

    ----------------------

    Microsoft solved this problem a long time ago by distributing the Analysis Tool
    Pak. I have heard rumors that it will be an integral part of Excel12 and not
    even require that you navigate to Tools/Add-ins and check the already appearing
    option.

    I suspect that Microsoft does not respond to many suggestions because, if they
    are like this and similar messages frequently posted here, there is so much
    "noise" embedded with the useful suggestions that even useful one's may get
    ignored or overlooked.

    Rather than appending a message with useless boiler-plate, it would be best to
    first find out if the so-called suggestion has already been fixed.
    --ron

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1