+ Reply to Thread
Results 1 to 7 of 7

Creating a formula to populate range of cells between dates based on start and end dates

  1. #1
    Registered User
    Join Date
    07-16-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    15

    Exclamation Creating a formula to populate range of cells between dates based on start and end dates

    Hi All,

    A contributor was able to help me with the first part of this formula. However, I noticed the formula doesn't work on a date range beyond 12 months.

    I've re-posted this thread with the hope that I can get an answer to the second part:

    If you refer to the attached excel file you will notice the Project Manager profile is working from the 01/01/2015 to the 28/02/16. The formula in cell F6 however only identifies the months and not years. So rather than equaling 1 year and 2 months it calculates to 2 months. Likewise the formula in cell range G6:V6 doesn't work on a date range of greater than 12 months (highlighted in yellow).

    Can someone help/show me how I can get the formula to work beyond 12 months?

    Many thanks!
    Remon
    Attached Files Attached Files

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Creating a formula to populate range of cells between dates based on start and end dat

    if you subtract 2 dates you get the number of days
    e4-d4 =150
    150 is the date code for 29/05/1900
    formatted as mm gives the month 5
    you can use datedif
    =DATEDIF(D4,E4,"m") this will give 4 though as it calculates complete months
    you could add 1 to the date to get 5
    =DATEDIF(D4,E4+1,"m")
    it all depends whay you call a month
    is it a period of say 30 days or a calender month
    10/11/2012 to 13/12/2012 is that one month or ?
    Last edited by martindwilson; 07-20-2014 at 12:05 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Thumbs up Re: Creating a formula to populate range of cells between dates based on start and end dat

    Use datedif() function
    easy and simple...

    check the attachment



    Don't forget to click *, if it helps you someway...
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-16-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    15

    Re: Creating a formula to populate range of cells between dates based on start and end dat

    Hi Vikas,

    Thanks for your reply. What about the formula in cell range G6:V6? This is the one I really want updating. I want the cell range to be populated based on the date date range in column D and E. However, at the moment, it only works for 12 months.

    Thanks,
    Remon

  5. #5
    Registered User
    Join Date
    07-16-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    15

    Re: Creating a formula to populate range of cells between dates based on start and end dat

    Hi martindwilson,

    Thanks for your reply. What about the formula in cell range G6:V6? This is the one I really want updating. I want the cell range to be populated based on the date date range in column D and E. However, at the moment, it only works for 12 months.

    Thanks,
    Remon

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Creating a formula to populate range of cells between dates based on start and end dat

    just change g4 to fill across and down
    =IF(COUNTA($G$3:G$3)<=$F4,($C4*G$2),"") no need to calculate the months each time you have already done that in column f

  7. #7
    Registered User
    Join Date
    07-16-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    15

    Re: Creating a formula to populate range of cells between dates based on start and end dat

    Hi martindwilson,

    Thanks very much - that works perfectly well now. Looking at the formula now it looks so simple!

    Many thanks,
    Remon

+ 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. Need a formula with flexible start and end dates from a range
    By Lax97 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2017, 12:23 PM
  2. [SOLVED] Creating a formula to populate range of cells between dates based on start and end dates
    By Rainmain82 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-18-2014, 07:55 AM
  3. Replies: 12
    Last Post: 03-07-2013, 11:02 PM
  4. Highlighting range of cells based on start and end dates
    By d0gp1l3 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-13-2012, 12:36 PM
  5. Populate row information based on start end dates
    By rdesai7677 in forum Excel General
    Replies: 6
    Last Post: 03-12-2012, 06:41 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