+ Reply to Thread
Results 1 to 8 of 8

Formula to generate last day of month

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Formula to generate last day of month

    Hi :

    I need to know if excel have a formula to generate date for middle of the month and last day of the month.

    Example:

    1/15/2012
    1/31/2012
    2/15/2012
    2/29/2012
    etc...

    Thanks

    RM
    Last edited by rizmomin; 02-20-2012 at 03:57 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Formula to generate last day of month

    Assuming the date is in D1 this formula will return last day of the month

    =DATE(YEAR(D1),MONTH(D1)+1,0)

    Not sure about the middle
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    02-08-2012
    Location
    Westlake Village, CA
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Formula to generate last day of month

    Assuming cell D1 = 2/1/12, the following formula should return whichever day you specify (in this case, I have assumed the 15th):

    =DATE(YEAR(D1),MONTH(D1), 15)

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Formula to generate last day of month

    This might work for middle of the month

    =DATE(YEAR(D1),MONTH(D1),DAY(DATE(YEAR(D1),MONTH(D1),0))/2)

    As you are using Excel 2010

    last day of month:

    =EOMONTH(D1,0)

    middle day of month

    =DATE(YEAR(D1),MONTH(D1),DAY(EOMONTH(D1,0))/2)

    For the above in earlier versions you would need the Analysis ToolPak installed
    Last edited by royUK; 02-20-2012 at 03:46 PM.

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

    Re: Formula to generate last day of month

    If you want a series of dates like that then put the first date in A1 and then this formula in B1 copied as far as you need

    =IF(DAY(A1)=15,17-DAY(A1+17),15)+A1
    Audere est facere

  6. #6
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Formula to generate last day of month

    Hi ALL;

    This will surely work for my project.
    I still am looking for help on my tread "Working Week Split"

    i would appreciate if someone can have a look and help me with this.

    This is in part of coming up a solution for calcualting overtime if paid semi-monthly.

    Please let me know if you have any questions.

    Thank you all for helping ...

    RM
    Last edited by rizmomin; 02-20-2012 at 04:05 PM.

  7. #7
    Registered User
    Join Date
    10-13-2011
    Location
    Northern California
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Formula to generate last day of month

    If the middle of the month would always be the 15th, which seems to be implied from your example where it's the middle of 31-day January and 29-day February, then given a date in cell X99, the 15th day of that date's month is given by

    =X99-DAY(X99)+15

    Last day of the month for the date in X99 could also be given by

    =X99-DAY(X99)+32-DAY(X99-DAY(X99)+32)

    That said, since the OP indicates using Excel 2010, just use EOMONTH,

    =EOMONTH(X99,0)

  8. #8
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Formula to generate last day of month

    Hi ALL:

    Please refer tto the attached sheet to see what i am trying to accomplish.

    I need to get a date range START END as shown in Column N and O.
    I also need to create a calender like shown in left side..
    Thanks and please let me know if u have questions

    RM
    Attached Files Attached Files
    Last edited by rizmomin; 02-20-2012 at 04:41 PM.

+ 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