+ Reply to Thread
Results 1 to 6 of 6

subtract a periode with another period(DATEDIF)

  1. #1
    Registered User
    Join Date
    05-28-2020
    Location
    Belgium
    MS-Off Ver
    365
    Posts
    25

    subtract a periode with another period(DATEDIF)

    HEllo everbody,

    I have this formula :

    Please Login or Register  to view this content.
    How can I subtract 54 months and 26 days from this period.

    In my file :

    a28 = a14 - a25

    Thnaks for all

    HABILER
    Attached Files Attached Files
    Last edited by Habiler; 05-28-2020 at 05:34 AM.

  2. #2
    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,790

    Re: subtract a periode with another period(DATEDIF)

    To get the date you are looking for:

    =EDATE(A1,-54)-26

    where A1 contains the base date. Then apply your required formatting.
    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.

  3. #3
    Registered User
    Join Date
    05-28-2020
    Location
    Belgium
    MS-Off Ver
    365
    Posts
    25

    Re: subtract a periode with another period(DATEDIF)

    Thanks for your answer.

    The problem is that the value isn't a date but the result of a formula /

    In case :

    =SUMPRODUCT(DATEDIF(C10:C20;D10:D20+1;"y")) + INT((SUMPRODUCT(DATEDIF(C10:C20;D10:D20+1;"ym"))+INT(SUMPRODUCT(DATEDIF(C10:C20;D10:D20+1;"md"))/30))/12) & " years "
    & MOD(SUMPRODUCT(DATEDIF(C10:C20;D10:D20+1;"ym"))+INT(SUMPRODUCT(DATEDIF(C10:C20;D10:D20+1;"md"))/30);12) & " months "
    & MOD(SUMPRODUCT(DATEDIF(C10:C20;D10:D20+1;"md"));30) & " days"

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: subtract a periode with another period(DATEDIF)

    Hello Habiler and Welcome to Excel Forum.
    Perhaps going about this in a different manner may help.
    This proposal employs 4 helper columns (H:K) which may be moved and/or hidden for aesthetic purposes.
    Column H is populated using: =(DATEDIF(B4,C4,"d")+1)*D4
    Column I is populated using: =ROUNDDOWN(H4/365.2422,0)
    Column J is populated using: =ROUNDDOWN((H4-I4*365.2422)/30.44,0)
    Column K is populated using: =ROUNDDOWN(H4-I4*365.2422-J4*30.44,0)
    The final answer in cell B30 is displayed using: =I30 & " ans " &J30 & " mois " & K30 & " jours"
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    05-28-2020
    Location
    Belgium
    MS-Off Ver
    365
    Posts
    25

    Re: subtract a periode with another period(DATEDIF)

    Thanks For you answer but I have a problem with the result of Row 7.

    It must be a full year.

    1 year and 3 month not 29 days.

    How can i resolve this ?

    Thanks for all

    Habiler

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: subtract a periode with another period(DATEDIF)

    Let try the following:
    For years: =DATEDIF(B4,(C4+1),"y")*D4
    For months: =DATEDIF(B4,(C4+1),"ym")*D4
    For days: =IF(B4="",0,DATEDIF(B4,(C4+1),"md"))*D4
    In row 28 get the sum of each column and then, in cell K28, get a date using: =DATE(H28,I28,J28)
    Using AliGW's suggestion get the final date, in cell K30, using: =EDATE(K28,-I29)-J29
    Parse the final date using:
    In H30: =YEAR(K30)-1900
    In I30: =MONTH(K30)
    In J30: =DAY(K30)
    Let us know if you have any questions.
    Attached Files Attached Files

+ 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] Change Macro for trial periode in excel sheet
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-19-2015, 06:32 PM
  2. [SOLVED] DATEDIF - DATEDIF Calculation returning a negative for days or months
    By DaveBre in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-27-2015, 06:22 PM
  3. [SOLVED] Datedif of two dates, limited to a specific period
    By jessecain in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-24-2015, 04:18 AM
  4. [SOLVED] Calculate value in spesific time periode
    By tonny_hartono in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-20-2013, 04:29 PM
  5. VBA copie coller de données sous condition de période
    By demahom08 in forum Non English Excel
    Replies: 2
    Last Post: 04-08-2013, 07:48 AM
  6. DateDif Average? Damn DateDif
    By UTCHELP in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 12-10-2012, 08:53 AM
  7. Attempting to subtract time for a 24 hour period
    By JimM in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-19-2007, 09: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