+ Reply to Thread
Results 1 to 4 of 4

how to get last day of previous 2 months...

  1. #1
    Valued Forum Contributor
    Join Date
    12-22-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003 & Excel/Access 2007
    Posts
    438

    how to get last day of previous 2 months...

    This formula calculates the last day of the previous month…

    =DATE(YEAR(TODAY()),MONTH(TODAY()),0)

    What would I need to do to adjust so it can give me the last day of the previous 2 months… in this case April. Don’t know if I can take it further but is it possible to just have it give me the 1st day and last day for two months back??? In this case april 1st – april 30th… if that last part can’t be done that’s okay I would like at least to calculate the last day of the previous 2months if possible.

    What I’m doing with the current formula is running a report that picks up accounts that are past due before the last day of the previous month… I want to separate them by months… so that’s why I’m asking for this. Thanks.
    Last edited by jgomez; 06-13-2011 at 01:35 PM.

  2. #2
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: how to get last day of previous 2 months...

    Quote Originally Posted by jgomez View Post
    This formula calculates the last day of the previous month…

    =DATE(YEAR(TODAY()),MONTH(TODAY()),0)

    What would I need to do to adjust so it can give me the last day of the previous 2 months… in this case April. Don’t know if I can take it further but is it possible to just have it give me the 1st day and last day for two months back??? In this case april 1st – april 30th… if that last part can’t be done that’s okay I would like at least to calculate the last day of the previous 2months if possible.

    What I’m doing with the current formula is running a report that picks up accounts that are past due before the last day of the previous month… I want to separate them by months… so that’s why I’m asking for this. Thanks.
    Something like:

    =DATE(YEAR(TODAY()),MONTH(TODAY())-1,0)

    To include the 1st business that you wanted:
    ="1st - "&TEXT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,0),"mmmm dd, yyyy")

    EDIT: And this one is long but will return 1st - April 30th 2011 (with the words "st" and "th"):
    Please Login or Register  to view this content.
    Last edited by ron2k_1; 06-09-2011 at 05:32 PM.
    Ron
    Knowledge is knowing that a tomato and pepper are fruits. Wisdom is knowing whether to put these in a fruit salad

    Kindly

    [1] Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks
    [2] Mark your post [SOLVED] if it has been answered satisfactorily by editing your original post in advanced mode.
    [3] Thank (using the little scale) those that provided useful help; its nice and its very well appreciated

  3. #3
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: how to get last day of previous 2 months...

    Hello Jgomez, try,

    For 1st day.

    =EOMONTH(TODAY(),-3)+1

    For last day,

    =EOMONTH(TODAY(),-2)

    If you are on XL2003 or prior, this would require AnalysisToolpak AddIns to activate. If you are getting any #NAME error , see the excel help to how to activate it.

    This will work with any version.

    1st day

    =DATE(YEAR(TODAY()),MONTH(TODAY())-2,1)

    Last day,

    =DATE(YEAR(TODAY()),MONTH(TODAY())-1,0)
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  4. #4
    Valued Forum Contributor
    Join Date
    12-22-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003 & Excel/Access 2007
    Posts
    438

    Re: how to get last day of previous 2 months...

    Thanks they all worked...

+ 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