+ Reply to Thread
Results 1 to 10 of 10

calculate numbers of days elapsed a week, month or 6 months from now

  1. #1
    Registered User
    Join Date
    09-01-2011
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    78

    calculate numbers of days elapsed a week, month or 6 months from now

    In one column I'll have a list incrementing in 1w,2w,3w,1month and I want to be able to count the number of days that have elapsed till the latest cell. Right now I'm just winging it by saying there's always 31 days in one month using a COUNTA function, but I need it to be accurate.


    daycount.xlsx


    Doc attached.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: calculate numbers of days elapsed a week, month or 6 months from now

    Using your posted workbook...
    Note:
    No calculation will be "accurate" if you don't have a start date and a duration.
    I set a standard month at 1/12 of a year and a week as 1/365 of a year.

    Try this regular formula, copied down
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    09-01-2011
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: calculate numbers of days elapsed a week, month or 6 months from now

    What about using a start date of today(). How would I do it then?

    DCF is a daycount calculation. So I actually need a number which is frac/365 days per year.
    Last edited by labogola; 12-31-2013 at 11:58 PM.

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: calculate numbers of days elapsed a week, month or 6 months from now

    If the start date is today, try this regular formula, copied down
    Please Login or Register  to view this content.
    Is that something you can work with?

  5. #5
    Registered User
    Join Date
    09-01-2011
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: calculate numbers of days elapsed a week, month or 6 months from now

    Yeee boiii! Now getting on to figuring out this formula.

  6. #6
    Registered User
    Join Date
    09-01-2011
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: calculate numbers of days elapsed a week, month or 6 months from now

    Can someone explain this : LOOKUP(10^10,--LEFT(A2,{1,2}))*7

    I've changed 10^10 to random numbers and it still works

    Also what does the -- do?

    what about the {1,2}

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: calculate numbers of days elapsed a week, month or 6 months from now

    Regarding: LOOKUP(10^10,--LEFT(A2,{1,2}))*7

    This section: LEFT(A2,{1,2})
    Returns a 2-element array that contains the left one and two characters of A2
    If A2 contains 1W...the array is: {"1","1w"}

    The double-minus is an unambiguous way to coerce numeric text into an actual number.
    So --{"1","1w"} becomes {1,#VALUE!}

    If A2 contained 10M, the final array would be {1,10}

    (You could also multiply by 1, divide by 1, etc...but those methods might be misinterpreted as formula typos.)

    Last, the LOOKUP function has a convenient feature. If the lookup value is larger than any of the list elements, it returns the LAST element of the search type (text or numeric). If the lookup value is numeric, it returns the last numeric element. If the lookup value is text, it returns the last text element.

    Since we're looking for a number and that number is certain to be less than 10^10, the above formula returns the largest number in the array.

    I hope that helps.

  8. #8
    Registered User
    Join Date
    09-01-2011
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: calculate numbers of days elapsed a week, month or 6 months from now

    (EDATE(TODAY(),LOOKUP(10^10,--LEFT(A2,{1,2})))-TODAY())

    this returns a date format which can't be divided by 365. how come it's working in this formukla?>
    Last edited by labogola; 01-01-2014 at 01:33 AM.

  9. #9
    Registered User
    Join Date
    09-01-2011
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: calculate numbers of days elapsed a week, month or 6 months from now

    ^^ anyone?>

  10. #10
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: calculate numbers of days elapsed a week, month or 6 months from now

    That formula section does not return a date format. It returns the number of days between today and the date that is x-number-of-months in the future as specified in A2. If your test cell displays a date, that's only because it's formatted as a date. You should be able to enter this: =(EDATE(TODAY(),LOOKUP(10^10,--LEFT(A2,{1,2})))-TODAY())/365 without incident

+ 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. Elapsed Years : Months: Days
    By Larry.LeBlanc@O in forum Excel General
    Replies: 1
    Last Post: 04-01-2010, 12:07 PM
  2. Excel formats for ELAPSED years months days
    By Larry.LeBlanc@O in forum Excel General
    Replies: 1
    Last Post: 03-31-2010, 07:56 PM
  3. formula to calculate numbers of days (i.e. Monday's) in a month
    By Carol in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-06-2007, 07:31 AM
  4. [SOLVED] Calculate elapsed working days
    By RUSH2CROCHET in forum Excel General
    Replies: 6
    Last Post: 03-09-2006, 04:40 PM
  5. design question: array of elapsed days per month
    By KR in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2005, 01:05 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