+ Reply to Thread
Results 1 to 10 of 10

Allocate months across periods in which they fall?

  1. #1
    Registered User
    Join Date
    07-16-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Allocate months across periods in which they fall?

    Hi there,

    I have several hundred date ranges i.e. 1/1/09 - 1/1/11. I'm trying to allocate the number of months in each across the financial years ended 31/7/08 - 31/7/19 e.g. months in the financial year ended 31/7/09 would return 7 months and 31/7/12 onwards would return nil. The attached file should make it fairly obvious what I'm looking to achieve (hopefully)!

    I've found the following thread - http://excel.bigresource.com/Track/excel-5l9CSSlj/ - which is trying to achieve the same as I am, except in terms of days/months rather than months/years - however, I've not had much luck modifying the formula for my own use. The first row in the attached document gives an idea of what I've done.

    So - can anyone advise where I'm going wrong? Any help would be much appreciated!Example.xlsx

    NB - now cross-posted to http://www.mrexcel.com/forum/showthr...14#post3210514. Any advice is still appreciated!
    Last edited by maladrat; 07-16-2012 at 06:26 PM.

  2. #2
    Registered User
    Join Date
    07-16-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Allocate months across periods in which they fall?

    Bumped - anybody?

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Allocate months across periods in which they fall?

    In C2 and copy right and down,

    =MAX(0, MIN(C$1, $B2) - MAX(EDATE(C$1, -12), $A2))

    That gives the number of days in each fiscal year. Convert to months as you wish.
    Last edited by shg; 07-17-2012 at 12:28 PM.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    07-16-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Allocate months across periods in which they fall?

    Apologies for not thanking you for this - was posted just before a week of sick leave.

    One issue - I've converted to months using

    =month(MAX(0, MIN(C$1, $B2) - MAX(EDATE(C$1, -12), $A2)))

    However, the formula seems to round up - for example, periods containing 0 days return '1' month, and a period containing 92 days returns 4 months rather than 3. Please could you advise how I can avoid this, and make it either round down, or alternatively return part months e.g. 3.5 months? Thank you!

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Allocate months across periods in which they fall?

    The MONTH function gives the month of a given date (e.g., MONTH("7/26/2012") returns 7, for July). It does not count months.

    The formula I posted gives days of overlap in a given month. I don't know what you are additionally trying to do.

  6. #6
    Registered User
    Join Date
    07-16-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Allocate months across periods in which they fall?

    Ah, I seem to have completely misunderstood what the MONTH function does.

    I'm just looking to have the formula display months per period instead of days per period, rounded down to the nearest month, or displayed as a portion of a month e.g. 0.5 months. Hopefully the attached example should explain things better than I can articulate! Thanks.

    Example 2.xlsx

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Allocate months across periods in which they fall?

    Right. So there are 346 days of overlap for the fiscal year ending 7/31/10. How many months is that? You could divide by 30.4 (~ the average number of days in a month), but there is no exact answer.

  8. #8
    Registered User
    Join Date
    07-16-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Allocate months across periods in which they fall?

    Unbelievable - very embarrassing, such an obvious solution! Dividing by 30.4 does the job perfectly, thanks again!

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Allocate months across periods in which they fall?

    You're welcome, good luck.

  10. #10
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Allocate months across periods in which they fall?

    @ maladrat

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

+ 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