+ Reply to Thread
Results 1 to 13 of 13

Date query

  1. #1
    Registered User
    Join Date
    05-18-2016
    Location
    Manchester, England
    MS-Off Ver
    Windows 7
    Posts
    9

    Date query

    I am looking for a solution to the following problem.

    Cell A1 contains date 18/04/2016

    I need to show in Cell A2, the date calculated as 17/05/2016, one month on.

    If the date in cell A1 is 01/05/2016, A2 needs to show 30/06/2016.

    I have tried extracting the month integer from cell A1 by formula: =month(A1) then adding 1 to it, similar with =day(A1) then rebuilding the date with concatenate function, but when the date in cell A1 is the first of the month, the rebuilt date goes to 00 and not the last day of the previous month.

    Please help.
    Last edited by kipaqra; 06-02-2016 at 04:17 AM.

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Date query

    Please Login or Register  to view this content.
    http://www.techonthenet.com/excel/formulas/dateadd.php
    If someone has helped you then please add to their Reputation

  3. #3
    Registered User
    Join Date
    05-18-2016
    Location
    Manchester, England
    MS-Off Ver
    Windows 7
    Posts
    9

    Re: Date query

    That just adds a month onto the date in A1 with the same date ie.

    If A1 = 18/04/2016, using date add sets A2 = 18/05/2016

    Whereas I need the preceding date, the 17th of May.
    Last edited by kipaqra; 06-02-2016 at 03:53 AM.

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Date query

    =edate(a1,1)-1
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Registered User
    Join Date
    05-18-2016
    Location
    Manchester, England
    MS-Off Ver
    Windows 7
    Posts
    9
    Quote Originally Posted by nflsales View Post
    =edate(a1,1)-1
    Much appreciated, thank you works fine for middle of the month but still does not work if A1 is 01/04/2016
    Last edited by kipaqra; 06-02-2016 at 03:48 AM.

  6. #6
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Date query

    Do two DATEADDs then
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-18-2016
    Location
    Manchester, England
    MS-Off Ver
    Windows 7
    Posts
    9
    Quote Originally Posted by pjwhitfield View Post
    Do two DATEADDs then
    Please Login or Register  to view this content.
    That just returns: #NAME?

  8. #8
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Date query

    Try

    =IF(DAY(A1)=1,EOMONTH(A1,-1),EDATE(A1,0)-1)
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  9. #9
    Registered User
    Join Date
    05-18-2016
    Location
    Manchester, England
    MS-Off Ver
    Windows 7
    Posts
    9
    Quote Originally Posted by shukla.ankur281190 View Post
    Try

    =IF(DAY(A1)=1,EOMONTH(A1,-1),EDATE(A1,0)-1)
    That works fine for the 1at of the month but does not work for any other day of the month

  10. #10
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Date query

    As your asked in your post#6 I gave solution accordingly.

    If you need anything else please speak inone time pls

  11. #11
    Registered User
    Join Date
    05-18-2016
    Location
    Manchester, England
    MS-Off Ver
    Windows 7
    Posts
    9

    Re: Date query

    If I have to use multiple cells to achieve what I want so be i.

  12. #12
    Registered User
    Join Date
    05-18-2016
    Location
    Manchester, England
    MS-Off Ver
    Windows 7
    Posts
    9
    Quote Originally Posted by shukla.ankur281190 View Post
    As your asked in your post#6 I gave solution accordingly.

    If you need anything else please speak inone time pls
    Did you read the original post?

  13. #13
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Date query

    Can you please upload your spreadsheet here with expected result.

    Go to advance click on paper clip icon and attach the workbook

+ 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. QUERY WEB from URL that change date every day
    By robgiuss in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-29-2014, 01:51 PM
  2. Convert US Date to UK date for Web Query
    By hayalperest in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-25-2013, 09:28 AM
  3. Replies: 2
    Last Post: 12-09-2011, 08:51 AM
  4. Date Query
    By Eric60 in forum Excel General
    Replies: 7
    Last Post: 07-02-2009, 06:13 AM
  5. Date query?
    By Harley in forum Excel General
    Replies: 2
    Last Post: 05-11-2006, 06:35 AM
  6. [SOLVED] How do I enter a date range ie -7 from current date in MS QUERY
    By notsmartenough in forum Excel General
    Replies: 1
    Last Post: 11-11-2005, 06:25 PM
  7. A Date Query
    By SamuelT in forum Excel General
    Replies: 3
    Last Post: 10-11-2005, 09:54 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