+ Reply to Thread
Results 1 to 11 of 11

Datediff() to Show Date as Result

  1. #1
    Registered User
    Join Date
    06-13-2013
    Location
    York
    MS-Off Ver
    Excel 2003
    Posts
    24

    Datediff() to Show Date as Result

    Need a date diff but not just days DD/MM/YY format.

    Can only find a days difrence
    Last edited by AliGW; 09-09-2018 at 06:08 AM.

  2. #2
    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: Datediff()

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


    will show the number of months and "y" instead of "m" the number of years.
    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.

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Datediff()

    Hi

    Can you show an example to help us?

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

    Re: Datediff() to Show Date as Result

    I have changed your thread title to better explain your request. In future, please adhere to these simple rules for thread titles:

    • Use concise, accurate thread titles.
    • Your post title should describe your problem, not your anticipated solution.
    • Use terms appropriate to a Google search - poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice tell us nothing.
    • Responding to a request to change your thread title by doing so is mandatory.

    To change a title go to your first post, click EDIT then Go Advanced and change your title.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Datediff() to Show Date as Result

    So you want something like this?

    =DATEDIF(A1,A2,"y")&" years "&DATEDIF(A1,A2,"ym")&" months "&DATEDIF(A1,A2,"md")&" days"

    Which will give lapsed time (age) in years, months and days.

    The order of the 3 datedifs can be changed as needed.
    Last edited by jason.b75; 09-10-2018 at 03:15 AM.

  6. #6
    Registered User
    Join Date
    06-13-2013
    Location
    York
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Datediff()

    But how about this?

    =DATEDIF(start_date,end_date,"y,m,d")

  7. #7
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Datediff() to Show Date as Result

    Not with a single function.

    If you want the result in that format, change " years " to "," etc.

    https://support.office.com/en-us/art...d-8b32a451b35c

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Datediff() to Show Date as Result

    Need a date diff but not just days DD/MM/YY format.
    Need a date diff but not just days DD/MM/YY format.
    You've had a lot of answers but it looks to me like you are misunderstanding the datdif function (or any date where you are showing the difference between two dates).
    the datdif function will show you either years, months, days or years and months or years and days that are the difference between two dates.
    So if the date dif was 47 days how would showing it as 02/16/1900 give you any understanding of the answer? You can throw a text function into the formula like =text(dated(B1,A1,"d"),"dd/mm/yy") but it will show a (for example) difference of 47 days as 16/02/00 which doesn't make sense.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  9. #9
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Datediff() to Show Date as Result

    Quote Originally Posted by Sambo kid View Post
    ... You can throw a text function into the formula like =text(dated(B1,A1,"d"),"dd/mm/yy") but it will show a (for example) difference of 47 days as 16/02/00 which doesn't make sense.
    But =TEXT(DATEDIF(B1,A1,"d"),"y ""years,"" m ""months and ""d ""days.""") is more readable.
    00 years, 2 months and 16 days.

  10. #10
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Datediff() to Show Date as Result

    Yes Jose, that occurred to me after I posted and while out jogging that maybe what otuatail was wanting, and I have a canned one already I use for similar purposes.
    =DATEDIF(A1,TODAY(),"y")&" years, "&DATEDIF(A1,TODAY(),"ym")&" months, "&DATEDIF(A1,TODAY(),"md")&" days" which will give similar results to yours like...22 years, 8 months, 0 days for example.

  11. #11
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Datediff() to Show Date as Result

    Quote Originally Posted by José Augusto View Post
    But =TEXT(DATEDIF(B1,A1,"d"),"y ""years,"" m ""months and ""d ""days.""") is more readable.
    00 years, 2 months and 16 days.
    It is also extremely inacurate, Jose!

    That will always give 2 months, 16 days for a 47 day date difference, where the methods suggested by Sambo and myself will return a more accurate 1 month and 16 - 19 days depending on which months are specified.

+ 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] Issues with Datediff
    By grkchakri in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2018, 09:15 AM
  2. DateDiff
    By YBrazeau in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-31-2009, 12:09 PM
  3. DateDiff
    By vandanavai in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2006, 03:12 AM
  4. DateDiff
    By RetepNamenots in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-16-2006, 04:03 PM
  5. datediff help
    By ina in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-24-2006, 04:50 AM
  6. DateDIFF
    By Paul Breslin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2005, 11:15 AM
  7. [SOLVED] Help with datediff vba
    By John in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2005, 10:42 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