+ Reply to Thread
Results 1 to 4 of 4

Date difference between one source and 2 possible cells

  1. #1
    Registered User
    Join Date
    09-17-2018
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    2

    Date difference between one source and 2 possible cells

    Hey all,

    My sheet is working with 3 possible sources for dates, Call them Column A and Column B (each row will have one or the other but not both) and Column C (which every one will have and is always a later date than Either A or B). I am trying to have Column D Pull dates from A or B depending if one is blank and provide the difference with Column C. Been trying to make =IF(A5="","",(DATEDIF(B5,C5,"D"))) work however it returns a 42810 value

  2. #2
    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: Date difference between one source and 2 possible cells

    Hi, welcome to the forum

    I would do this as follows (based on the formula you gave)...
    =DATEDIF(if(a5="",B5,a5),C5,"D")

    What you need to understand about dates and times in excel is…

    a date is just a number representing the number of days passed since 1/1/900...and then formatted in a way that we recognize as a date. So, for instance, today (Mon 17 Sep 2018) is actually 43360

    Time is actually a decimal part of 1 (day), so 06:00 AM is 0.25, 12 noon is 0.5 and 18:00 (or 6 PM) is 0.75

    So if your answer is 42810, that is actually 3/16/2017
    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

  3. #3
    Registered User
    Join Date
    09-17-2018
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    2

    Re: Date difference between one source and 2 possible cells

    That appears to be working perfectly, thank you.

  4. #4
    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: Date difference between one source and 2 possible cells

    Happy to help and thanks for the feedback

+ 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. Replies: 3
    Last Post: 09-25-2019, 01:26 AM
  2. Replies: 6
    Last Post: 05-14-2016, 08:34 PM
  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. VBA to format cells based on difference from todays date
    By Cantdoexcel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-07-2012, 04:27 AM
  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

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