+ Reply to Thread
Results 1 to 11 of 11

Use DATEDIF function in getting Age

  1. #1
    Registered User
    Join Date
    04-05-2015
    Location
    Saihat, Saudi Arabia
    MS-Off Ver
    2013
    Posts
    46

    Use DATEDIF function in getting Age



    Hi,

    DATEDIF function is a useful Excel function in calculating difference between dates; such as getting Age in the following formula:

    =DATEDIF(A2;TODAY();"y")&" Year, "&DATEDIF(A2;TODAY();"ym")&" Month, "&DATEDIF(A2;TODAY();"md")&" day"


    Name:  DATEDIF.jpg
Views: 6658
Size:  87.4 KB

  2. #2
    Valued Forum Contributor
    Join Date
    05-07-2014
    Location
    India
    MS-Off Ver
    MS Office 365
    Posts
    313

    Re: Use DATEDIF function in getting Age

    Hi,

    If you are getting any error in this formula please use below formula:-
    =DATEDIF(A2,TODAY(),"y")&" Year, "&DATEDIF(A2,TODAY(),"ym")&" Month, "&DATEDIF(A2,TODAY(),"md")&" day"

    Thanks
    Nisha

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Use DATEDIF function in getting Age

    In case anyone did not notice the difference, post 1 contains ; while post 2 contains ,
    These would be for different regional settings
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    04-05-2015
    Location
    Saihat, Saudi Arabia
    MS-Off Ver
    2013
    Posts
    46

    Re: Use DATEDIF function in getting Age

    Hi,
    Nisha Dhawan
    FDibbins

    Thank you for Clarification of difference between ( and (,)"this is applicable to all Excel Formulas".

    Regards

  5. #5
    Registered User
    Join Date
    04-05-2015
    Location
    Saihat, Saudi Arabia
    MS-Off Ver
    2013
    Posts
    46

    Re: Use DATEDIF function in getting Age

    Hi,

    Please note the following:
    • DATEDIF is a hidden function in Excel. As the name suggests the job of this function is to calculate the difference between two given dates.
    • I have referred this function as hidden because, for some reason Microsoft has decided not to document this function. Moreover, because of this you will not find this function in the Formula Tab.
    • To verify this, try to type =DATE in any cell. You will see Excel enlists all the functions that start with the word “date” but it does not shows DATEDIF.
    • DATEDIF Function in Excel is very different from the DATEDIFF (Notice the extra ‘F’) Function in VBA.

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Use DATEDIF function in getting Age

    Quote Originally Posted by IMA_Saihat View Post
    DATEDIF is a hidden function in Excel,I have referred this function as hidden because, for some reason Microsoft has decided not to document this function
    B'cos DatedIf() is not an Inbuilt worksheet function. It is an addin function which resides in Analysis Toolpak


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Use DATEDIF function in getting Age

    Quote Originally Posted by :) Sixthsense :) View Post
    B'cos DatedIf() is not an Inbuilt worksheet function. It is an addin function which resides in Analysis Toolpak
    This link lists all the ATP functions:

    https://support2.microsoft.com/defau...b;EN-US;291058

    Scroll down near the bottom of the page.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Use DATEDIF function in getting Age

    Just for the heck of it...

    Here's a version that uses grammatically correct forms of plurals.

    For example, you could get a result like this:

    1 Years 1 Months 1 Days

    That just doesn't roll off the tongue like it should!

    This formula will return:

    1 Year 1 Month 1 Day

    A1 = date of birth
    B1 = today's date

    =DATEDIF(A1,B1,"y")&" year"&IF(DATEDIF(A1,B1,"y")<>1,"s ","")
    &" "&DATEDIF(A1,B1,"ym")&" month"&IF(DATEDIF(A1,B1,"ym")
    <>1,"s ","")&" "&DATEDIF(A1,B1,"md")&" day"&IF(DATEDIF(A1,B1,"md")
    <>1,"s","")

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Use DATEDIF function in getting Age


  10. #10
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Use DATEDIF function in getting Age

    Quote Originally Posted by Tony Valko View Post
    This link lists all the ATP functions:
    Thanks for the correction

    I should check it before commenting

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Use DATEDIF function in getting Age

    In Excel 2003 and earlier with the Analysis ToolPak add-in installed, it's easy to differentiate the ATP functions from the built-in functions.

    If you have Function ToolTips enabled, when you start typing in a built-in function the Function ToolTip appears. For example,

    =count(

    Then the tooltip appears as:

    =count(
    COUNT(value1,[value2], ...)

    The DATEDIF function has a tooltip but it doesn't provide any arguments:

    =datedif(
    DATEDIF()

    ATP functions don't have tooltips:

    =networkdays(

    That's all you get!

    However, you can get the ATP and UDF function arguments by typing in the function:

    =networkdays(

    At that point use the key combo of CTRL + SHIFT + A and the function arguments will appear:

    =networkdays(start_date,end_date,holidays)

+ 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. Using DateDif function
    By wstring in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2014, 02:46 PM
  2. Datedif function
    By vinodeigc in forum Excel General
    Replies: 2
    Last Post: 11-30-2013, 05:43 AM
  3. #NUM! while using DATEDIF function
    By sriradh in forum Excel General
    Replies: 3
    Last Post: 08-22-2008, 03:21 PM
  4. DateDif Function
    By The Muffin Man in forum Excel General
    Replies: 2
    Last Post: 09-06-2007, 06:35 PM
  5. [SOLVED] Datedif function
    By shaji in forum Excel General
    Replies: 2
    Last Post: 05-13-2006, 09:40 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