+ Reply to Thread
Results 1 to 8 of 8

Date Difference

  1. #1
    Registered User
    Join Date
    05-21-2020
    Location
    New York
    MS-Off Ver
    365
    Posts
    4

    Date Difference

    Hi,

    I'm trying to find the date difference between transaction dates and expiration dates. These two fields are in different rows.

    My goal is try to find the amount of time before or after someone's expiration date. I tried using DATEDIF but it's returning #NUM! errors and doesn't return negative results. Can I use a pivot table to view the number of months between dates sorted by ID?

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Date Difference

    Can you be more specific as to which dates you are trying to compare. If you take some of your data you have shown and provide a manually prepared mock up we might understand better what you are after.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Date Difference

    Guessing as to what you want.

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    1
    ID TranDate ExpDate Days Difference
    2
    49
    1/2/2017
    11/29/2020
    1427
    3
    75
    2/5/2018
    6/30/2021
    1241
    4
    78
    3/15/2017
    9/22/2020
    1287
    5
    119
    3/27/2018
    10/22/2020
    940
    6
    127
    9/3/2017
    5/17/2021
    1352
    7
    128
    4/19/2017
    1/13/2020
    999
    8
    144
    8/4/2017
    9/23/2019
    780
    9
    153
    5/27/2017
    9/20/2020
    1212
    10
    157
    5/18/2018
    11/29/2020
    926
    11
    167
    7/20/2017
    5/11/2021
    1391
    12
    177
    4/16/2018
    11/25/2020
    954
    13
    262
    12/16/2016
    1/20/2020
    1130
    14
    311
    8/4/2018
    3/15/2021
    954
    15
    424
    6/6/2017
    2/19/2021
    1354
    16
    659
    6/29/2016
    7/6/2019
    1102
    Sheet: Table1

    Power Query Mcode

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-21-2020
    Location
    New York
    MS-Off Ver
    365
    Posts
    4

    Re: Date Difference

    Sorry I should have specified that in my initial question. For ID 49, I want to compare 1/2/2019 to 5/29/2019 (C2, B3). For ID 75, 12/31/2018 to 12/7/2018 (C4, B5) and 12/31/2019 and 11/29/2019 (C5, B6). Thanks!

    ID Transaction date Expiration Date
    49 1/2/2017 1/2/2019
    49 5/29/2019 11/29/2020
    75 2/5/2018 12/31/2018
    75 12/7/2018 12/31/2019
    75 11/19/2019 6/30/2021

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,901

    Re: Date Difference

    Try this in D2:

    =IF(A2=A3,B3-C2,"")

  6. #6
    Registered User
    Join Date
    05-21-2020
    Location
    New York
    MS-Off Ver
    365
    Posts
    4

    Re: Date Difference

    Oh wow that worked! Thanks so much!

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Date Difference

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  8. #8
    Registered User
    Join Date
    05-21-2020
    Location
    New York
    MS-Off Ver
    365
    Posts
    4

    Re: Date Difference

    Thank you for the tips! Very helpful.

+ 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. Calculating Difference (in days) between date ONLY IF both cells have date
    By howe7032 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-20-2021, 06:47 PM
  2. [SOLVED] difference between the start date of a task and the end date with wordays
    By joaofonte in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 04-15-2021, 06:43 AM
  3. I want to find the difference between todays date and the Date in the 10 column in VBA
    By erickmcburger in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-23-2015, 07:29 AM
  4. Replies: 5
    Last Post: 04-07-2014, 06:02 AM
  5. Difference bewteen Due & despatch date & Sue and today date
    By Enigmatise_1981 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-25-2013, 12:37 PM
  6. Replies: 15
    Last Post: 06-26-2012, 07:28 AM
  7. Difference between todays date and a future date minus the weekends?!
    By kastle1982 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-26-2006, 05:21 PM

Tags for this Thread

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