+ Reply to Thread
Results 1 to 15 of 15

Consolidating data from days to months

  1. #1
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Consolidating data from days to months

    Is there a way to extract data from an adjacent Excel worksheet (Daily) for one month and consolidate it to another worksheet (monthly)? Please see attached sheet. Thanks . If another way works better than Pivot Tables that is fine.
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Consolidating data from days to months

    hi there. you have more than 1 year inside. does the year not matter? if it does, then it's better to type like 1Jan2014 in MONTHLY sheet B1. you can always format cells -> Custom:
    mmm

    what you can do in your DAILY 2 sheet in the pivot is to right-click A4 or any other dates -> Group. you can choose either just Months if Years doesn't matter. if it does, choose Years too. shift Date to the Column Labels and you have what you want in MONTHLY sheet.

    if you want formulas in MONTHLY sheet (without years), try this in B2:
    =SUMPRODUCT((TEXT(DAILY!$A$2:$A$2923,"mmm")=B1)*DAILY!$B$2:$B$2923)
    do take note that B1 has an extra space behind "Jan", so it won't work. get rid of the space

    with years (you have to type 1jan2014 like i suggested), try:
    =SUMIFS(DAILY!$B:$B,DAILY!$A:$A,">="&B1,DAILY!$A:$A,"<="&EOMONTH(B1,0))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Consolidating data from days to months

    Try this...

    TEST.xlsm

    The file has a macro which will do what you are wanting to do I believe. You will need to enable macros. Once in click the button on the monthly sheet that says "Run Macro"

    The code is below:
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Consolidating data from days to months

    This works so awesome except the amount summed does not match the various months. For example, the macro returns the amount 2,021,438 for Hits January 2014 but it should be 446,601. Same is true for the other amounts. Thanks

  5. #5
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Consolidating data from days to months

    That is because it is summing all Januaries irrespective of year. I didn't know you wanted only 2014.

    Change this line:

    Please Login or Register  to view this content.
    To this...

    Please Login or Register  to view this content.
    BTW the way for this to work I changed you Month titles formatting from General to a custom formatting mmm, which essentially displays the Month only of any date entered. E.g. for Jan the cell contains 1/1/14...you could enter any day in January 2014 and the cell would still only show Jan. You could use this same technique if you wanted to keep other years separated.

    I would then rename your Month tab to 2014. If you do this though you will need to change the following line:

    Please Login or Register  to view this content.
    To this...

    Please Login or Register  to view this content.
    And so on for all your years
    If your questions has been answered to your satisfaction please don't forget to do the following:

    Add Reputation ... and ... Mark Thread as Solved

    Thanks,

    Ma 10:8b Freely you have received; freely give.

  6. #6
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Consolidating data from days to months

    I tried to make the changes. Obviously I am doing something wrong. I would like to keep all the years on the same worksheet. I attached what I did.
    Attached Files Attached Files

  7. #7
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Consolidating data from days to months

    TEST2.xlsm

    I corrected the vba...

  8. #8
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Consolidating data from days to months

    It works perfectly except it only updates Jan 2014. I experimented with changing the Monthly.Range but it didn't work.

  9. #9
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Consolidating data from days to months

    [It only updates Jan 2014 because in your daily tab 2014 has only Jan data. You will need more data for 2014 for more months to be calculated.

    Try this file. I made the other months contingent on the date in Jan. This should allow you to change the year in Jan and the years will change for the others. then rerun the code and it will calculate for that year.

    ATTACH]296890[/ATTACH]
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Consolidating data from days to months

    Spectacular. Thank you for your help!!

  11. #11
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Consolidating data from days to months

    Can you tell me how to copy this macro to an existing workbook? I have tried numerous times. I tried copying by by dragging the module to the destination workbook but received the following error message: 'Name conflicts with existing module, project or object library'. I tried copying and pasting also.

  12. #12
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Consolidating data from days to months

    It's because the module name is probably 'Module1" and you already have a "Module1" in your existing workbook. Delete your module 1 and then drag and drop the one from the test.

  13. #13
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Consolidating data from days to months

    Can you tell me how you would change the macro to select by rows instead of by columns as you did in this case?

  14. #14
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Consolidating data from days to months

    What exactly do you want to do with the data?

  15. #15
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Consolidating data from days to months

    I am just experimenting with the data.

+ 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. Grouping data over many days into months
    By ScottLor in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-07-2013, 04:30 PM
  2. Convert days -> Years, Months, Days, Hours, Minutes, Seconds
    By brharrii in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-06-2012, 06:44 PM
  3. converting days to years,months,days
    By Cindylu3 in forum Excel General
    Replies: 3
    Last Post: 02-09-2009, 07:32 PM
  4. Summing data from days to Months realtime
    By Jay-Nicolas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2008, 12:37 PM
  5. i have two days and i want the difference in days, months, year
    By maja in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-21-2006, 08:14 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