+ Reply to Thread
Results 1 to 9 of 9

Adjust EOMONTH formula to return closest end of month date to today?

  1. #1
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Adjust EOMONTH formula to return closest end of month date to today?

    So in one cell I have the TODAY() function and in another cell I am referencing that cell to obtain the end of month date using the EOMONTH formula. Is there anyway to adjust this formula so it would produce the below results:

    Today is 1/19/17 - Formula Returns 1/31/17
    Today is 2/4/17 - Formula Returns 1/31/17

    So what I am looking for is a formula that would return the closest end of month date to the current date, even if that end of month date is the month prior as in the second example.

    Thanks for the help.

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Adjust EOMONTH formula to return closest end of month date to today?

    Enter in B1 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 1/19/2017 1/31/2017
    2 2/4/2017 1/31/2017
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Adjust EOMONTH formula to return closest end of month date to today?

    ...another option with today's date in A1

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,652

    Re: Adjust EOMONTH formula to return closest end of month date to today?

    Try this formatted as a date:

    =IF((A1-EOMONTH(A1,-1))<(EOMONTH(A1,0)-A1),EOMONTH(A1,-1),EOMONTH(A1,0))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Adjust EOMONTH formula to return closest end of month date to today?

    Quote Originally Posted by AlKey View Post
    Enter in B1 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 1/19/2017 1/31/2017
    2 2/4/2017 1/31/2017
    Thanks for the reply.

    When I enter that formula in B1 and then change A1 to say 2/5/17, B1 returns 2/28/17?

  6. #6
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Adjust EOMONTH formula to return closest end of month date to today?

    =date(year(a1),month(a1)+if(day(a1)>15,1,),)

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Adjust EOMONTH formula to return closest end of month date to today?

    No, Make sure that you entered formula exactly as written.
    v A B
    1 1/19/2017 1/31/2017
    2 2/4/2017 1/31/2017
    3 3/5/2017 1/31/2017
    4 4/25/2017 1/31/2017

  8. #8
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Adjust EOMONTH formula to return closest end of month date to today?

    Quote Originally Posted by AliGW View Post
    Try this formatted as a date:

    =IF((A1-EOMONTH(A1,-1))<(EOMONTH(A1,0)-A1),EOMONTH(A1,-1),EOMONTH(A1,0))
    For whatever reason the first two answers did not work when copying and pasting the formulas provided, but this one did.

    Thank you all for the help!

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,652

    Re: Adjust EOMONTH formula to return closest end of month date to today?

    You're welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Formula to compare date (including month and year) from a listed date to today's date
    By mhewitson15 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-11-2014, 05:31 PM
  2. [SOLVED] Find closest date to today in a row of dates
    By scottmcclean in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-17-2014, 04:29 PM
  3. [SOLVED] Formula to find date closest to today
    By mattress58 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-09-2014, 12:18 PM
  4. [SOLVED] Formula for today's date as year month day
    By Jahzeal in forum Office 365
    Replies: 3
    Last Post: 10-21-2013, 06:50 AM
  5. [SOLVED] Find Entry With Closest Date and Time to Today
    By Steve N. in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-13-2012, 06:09 PM
  6. [SOLVED] Date formula using TODAY() and MONTH()
    By Sophster in forum Excel General
    Replies: 2
    Last Post: 06-08-2012, 10:06 AM
  7. Formula = Today's date + 1 month
    By jermsalerms in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-08-2006, 05:51 AM

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