+ Reply to Thread
Results 1 to 13 of 13

Grouping data over many days into months

  1. #1
    Registered User
    Join Date
    03-05-2013
    Location
    Boston, USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Grouping data over many days into months

    Hi guys,
    Anyone know of a quick way to combine dates? I have a large data set with multiple variables organized by day. I would like to lump all of the daily cells into a single sum for the month.

    Ex:

    1/1/13 2
    1/4/13 4
    1/17/13 4
    1/30/13 2

    Should become

    Jan 13 12

    Simplying summing all of the cells for each month by adding a row and using the sum function is taking a very long time, any way to group the cells using an automated function?

    Thanks

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Grouping data over many days into months

    assuming the date is in column A and amount in column B
    in column D extract the month and year from the list
    put this D2 asan array formula - so you need to use control+shift+enter to get the {}
    =VALUE(TEXT(INDEX($A$2:$A$135, MATCH(0, COUNTIF($D$1:D1, TEXT($A$2:$A$135, "mmm-yyyy")), 0)), "mmm-yyyy"))
    then in E2 put
    =SUMPRODUCT(--(MONTH(A1:A100)=MONTH(D2)),(B1:B100))
    which will sum each month
    NOTE - this will not calculate for changing years - just months*


    if you need years - use this in E2
    =SUMPRODUCT(--(MONTH(A1:A100)&YEAR(A1:A100)=MONTH(D2)&YEAR(D2)),(B1:B100))
    Attached Files Attached Files
    Last edited by etaf; 03-05-2013 at 03:13 PM.

  3. #3
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Grouping data over many days into months

    One way is to create a helper column which uses the MONTH function to extract the month from the date. Then use SUMIF to get the sum by month.
    Martin

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Grouping data over many days into months

    Select all your data and then on the Insert tab, click on Pivot Table. Drag the date column header into the Row Labels field and drag the amount into the values field. Click in the Pivot Table on one of the dates and Group. Group on Months and Years and the totals will be calculated for each month even if the year changes.

    The dates have to be Excel recognizable dates and when you create the Pivot table, select a range longer than is required for your data otherwise grouping on the date may be difficult.

  5. #5
    Registered User
    Join Date
    03-05-2013
    Location
    Boston, USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Grouping data over many days into months

    etaf,
    This returns N/A after the first 4 cells. Any idea what that is going on?

    thanks

  6. #6
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Grouping data over many days into months

    Hi ScottLor

    Assuming your data is in A1:B4

    Try for the month:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If there are different years in your data:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards Kevin


    Merged Cells (They are the work of the devil!!!)

  7. #7
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Grouping data over many days into months

    etaf,
    This returns N/A after the first 4 cells. Any idea what that is going on?

    thanks
    can we see a sample sheet ?

  8. #8
    Registered User
    Join Date
    03-05-2013
    Location
    Boston, USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Grouping data over many days into months

    I can't attach a sample sheet because of my company. I do not understand the reference to column D in you forumula
    =VALUE(TEXT(INDEX($A$2:$A$135, MATCH(0, COUNTIF($D$1:D1, TEXT($A$2:$A$135, "mmm-yyyy")), 0)), "mmm-yyyy"))

    Once D1 changes to a cell that overlaps with a cell above it containing a date, it returns an incorrect date.

    The file has the date, day month and year in column A and the value attached to each date in column B. I would like to sum all the values in column B that occur on the same month in the same year.

  9. #9
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Grouping data over many days into months

    what column are you putting the formula into - thats the column you need to use

  10. #10
    Registered User
    Join Date
    03-05-2013
    Location
    Boston, USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Grouping data over many days into months

    I am putting the formula into column D. Not sure what's going on, but once the D1 (w.o $)reference overlaps with a cell above it that already has the formula in it, it changes the value of the equation
    Last edited by ScottLor; 03-07-2013 at 04:15 PM.

  11. #11
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Grouping data over many days into months

    does the list start in row 2

    found this if it helps http://www.get-digital-help.com/2010...ting-in-excel/
    overlaps with a cell above it

  12. #12
    Registered User
    Join Date
    03-05-2013
    Location
    Boston, USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Grouping data over many days into months

    I'm sorry, ignore that last problem. I am still getting a #value for e2. Here are the equations.

    =VALUE(TEXT(INDEX($F$2:$F$135, MATCH(0, COUNTIF($N$1:N1, TEXT($F$2:$F$135, "mmm-yyyy")), 0)), "mmm-yyyy")) (entered as an array where, F is the date and N is the column w the equation)

    =SUMPRODUCT((MONTH(F1:F100)&YEAR(F1:F100)=MONTH(N2)&YEAR(N2)),(I1:I100)) (Where I is the value column.) do you see an error?

    Data Starts in row 2

  13. #13
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Grouping data over many days into months

    your sumproduct is different

    =SUMPRODUCT(--(MONTH(F1:F100)&YEAR(F1:F100)=MONTH(N2)&YEAR(N2)),(I1:I100))

    should work

    http://www.mcgimpsey.com/excel/formulae/doubleneg.html
    Last edited by etaf; 03-07-2013 at 04:35 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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