+ Reply to Thread
Results 1 to 18 of 18

Help - date substraction

Hybrid View

  1. #1
    Registered User
    Join Date
    05-18-2005
    Posts
    9
    Hi Dominique,

    Thank you for your help but I need to calculate the age of a certain people using the excel
    I need the answer in day, month, year. I ve the date of birth and i want to calculate the age.

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    One way is to format the result as custom and then enter "yy m d"

    or simply use the following formula in your cell
    =TEXT(B1-A1,"y m d")

    - Mangesh

  3. #3
    Registered User
    Join Date
    05-18-2005
    Posts
    9
    By formating the result as custom and then enter "yy m d"

    Difference between date of birth ( 23 / 1 / 1977) and as of today ( 19 /5 / 2005) is 28 years 4 months and 25 days which is not accurate, the right answer is 28 years 3 months and 26 days.

    Could you please help solving this.

  4. #4
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Sorry, my mistake. Thats not correct actually.

    Try this instead:

    =YEAR(A2)-YEAR(A1)-IF(MONTH(A2)>=MONTH(A1),0,1) & " " & MONTH(A2)-MONTH(A1)-IF(DAY(A2)>=DAY(A1),0,1) & " " & IF(DAY(A2)-DAY(A1)<0,DAY(DATE(YEAR(A2),MONTH(A2),1)-1)+(DAY(A2)-DAY(A1)),DAY(A2)-DAY(A1))

    Not fullly tested

    A1 = start date
    A2 = end date

    - Mangesh

  5. #5
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    A slight varaition:

    =YEAR(A2)-YEAR(A1)-IF(MONTH(A2)>=MONTH(A1),0,1) & " " & 12-(MONTH(A2)-MONTH(A1))-IF(DAY(A2)>=DAY(A1),0,1) & " " & IF(DAY(A2)-DAY(A1)<0,DAY(DATE(YEAR(A2),MONTH(A2),1)-1)+(DAY(A2)-DAY(A1)),DAY(A2)-DAY(A1))


    - Mangesh

  6. #6
    Registered User
    Join Date
    05-18-2005
    Posts
    9
    Wrong formula still trying to get it. Thank you for your help

  7. #7
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    can you give an example where it is failing

    Mangesh

+ 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