+ Reply to Thread
Results 1 to 9 of 9

macro to populate value based on difference of dates

  1. #1
    Registered User
    Join Date
    09-04-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    5

    macro to populate value based on difference of dates

    please help me to right a macro where differene of two dates will be months and that month will use to divide the no of days in second sheet and than those divided days will fill in cells from start date and ends with end date - eg

    Sheet one - Start date - 01/01/2014, end date - 01/02/2014

    Sheet two - no of days - 20

    Sheet three - Months are in columsn from Jan'14 - Dec'14

    Results - there are two months so 20/2 - 10 and value will enter 10 in Jan and 10 in Feb.... where its on month - it will be one entery.

    Please suggest

  2. #2
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: macro to populate value based on difference of dates

    I think I'd need to see a sample workbook to understand.
    1. Include a sample workbook with an example of the result you want
    2. Use [CODE] and [FORMULA] wrappers for your VBA code or excel formulas
    3. If your question has been answered, mark the thread as SOLVED and click on the "Add Rep" star to thank whoever helped you.

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: macro to populate value based on difference of dates

    Hi, nitinpanwar,

    you would need to explain why in your example given the first day of February is the End Date but you would like to fill in 10 days into February.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    09-04-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: macro to populate value based on difference of dates

    Dont use this file, see another below reply to use the file
    Attached Files Attached Files
    Last edited by nitinpanwar; 06-13-2014 at 06:08 AM.

  5. #5
    Registered User
    Join Date
    09-04-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: macro to populate value based on difference of dates

    Hi
    I manage to creae the template and steps, please find attached and need urgent help
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: macro to populate value based on difference of dates

    Hello nitinpanwar,

    I see the set-up for your example, but I don't see the sample data and the example of the results you want. If you can give some sample data and do the results by hand so we can see what you want, that would help.

  7. #7
    Registered User
    Join Date
    09-04-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: macro to populate value based on difference of dates

    Hi,
    Mnay thanks for your reply, please find attached the file with data.
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: macro to populate value based on difference of dates

    Is this what you wanted?
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    09-04-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: macro to populate value based on difference of dates

    Sorry but this is not what i wanted, i want results in tab 'res' if you can see steps defined in fist tab, and results defined in last tab, i am sure you will be anble to understand.
    Value should be auto placed in last jab under months column based on start and e nd date defined in first tab.. for ex if start date is 01/01/2014 and end date is 01/03/2014... and value against same date in tab two is 20 days... then 20 days will be devided with the difference of dates, which is two months means it will be 20/2 =10 and this 10 value will be than go to last tab under Jan and Feb that means 10 in Jan and 10 in feb... because from date start date, its jan and feb..

+ 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. [SOLVED] Populate monthly dates into workbook based upon day of week
    By Barney97 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-23-2013, 05:02 PM
  2. [SOLVED] Formula to Populate Dates Based on First Value Greater than 0
    By jai.anand@aol.in in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-08-2013, 02:33 PM
  3. Populate row information based on start end dates
    By rdesai7677 in forum Excel General
    Replies: 6
    Last Post: 03-12-2012, 06:41 PM
  4. Populate static dates based off entry of another cell
    By gopherc4 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-20-2007, 02:27 PM
  5. Macro for Recognising Difference in Dates
    By stevencarroll19 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-23-2006, 12:26 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