+ Reply to Thread
Results 1 to 6 of 6

Date range counted in days in new column

  1. #1
    Registered User
    Join Date
    02-05-2013
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2010
    Posts
    18

    Date range counted in days in new column

    Hello,

    I was wondering if I have a column with a set date range, such as this 05/20/2013 - 05/24/2013.

    Is there a formula that can interpret that and post to another column how many days? Simply giving a number of 5 for the date range.

    I would appreciate if you could give an example of how to do that. Thank you!!

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Date range counted in days in new column

    If they are truly dates and not text just subtract 1 date from the other and add 1

    =(A2-A1)+1

    where A1 and A2 are dates
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

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

    Re: Date range counted in days in new column

    I'm asssuming you mean this is all in a single cell:

    05/20/2013 - 05/24/2013

    If so, try this:

    =MID(A2,FIND("-",A2)+2,10)-LEFT(A2,FIND("-",A2)-2)+1
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    02-05-2013
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Date range counted in days in new column

    Thank you so much! Tony, that formula worked great! Exactly what I needed. I love this forum!

  5. #5
    Registered User
    Join Date
    02-05-2013
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Date range counted in days in new column

    I have one follow up question, can there be something added to that stating, that if >5 (days) then it will say NA or ERROR or whatever I would like it to say?

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

    Re: Date range counted in days in new column

    Sure. Like this:

    =IF(MID(A2,FIND("-",A2)+2,10)-LEFT(A2,FIND("-",A2)-2)+1>5,"NA",MID(A2,FIND("-",A2)+2,10)-LEFT(A2,FIND("-",A2)-2)+1)

+ 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