+ Reply to Thread
Results 1 to 4 of 4

Thread: Aggregating costs by date

  1. #1
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    21

    Aggregating costs by date

    I have a table with several columns including date and amount ($). I'm trying to create a function that will take a month and the table as inputs, and return the SUM of the amounts listed in that month.

    For example:

    TABLE1

    Date Amount
    1/12/11 $10
    1/30/11 $8
    3/6/11 $15
    8/20/11 $13
    1/2/11 $4
    6/5/11 $8

    So I want to make a function =SUMMONTH(month,table or array)

    In this case =SUMMONTH(January,TABLE1) = $22

  2. #2
    Valued Forum Contributor Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds/Sheffield, England
    MS-Off Ver
    Excel 2003
    Posts
    1,031

    Re: Aggregating costs by date

    No need to create a function, check out sumproduct/array formulas

    You're looking for something like

    =SUMPRODUCT(--(MONTH(A2:A5)=1),B2:B5)

    Where 1 is the number of the month you want from 1 to 12
    Last edited by Kyle123; 10-06-2011 at 12:29 PM. Reason: formula error
    Click the * below to say thanks

    Girls sleep with guys who use photoshop, but marry the ones who work with Excel

    Corduroy
    pillows: They're making headlines!

    Did you mean: recursion
    http://www.google.com/search?hl=en&q=recursion

  3. #3
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    02-15-2008
    Location
    Grappenhall, UK
    MS-Off Ver
    Excel for Windows & Mac - all versions.
    Posts
    6,566

    Re: Aggregating costs by date

    Does the attached help

    Regards
    Attached Files Attached Files
    Richard Buttrey

    If this was useful then please rate it appropriately.

    Click the small star icon at the bottom left of my post.

  4. #4
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Aggregating costs by date

    That did help. I ended up using this function:

    =SUMIFS(Table2[Amount],Table2[Year],B1,Table2[Month],C1)

    I had to create two extra columns that took the actual date and convert it to month and year for each row (Ex. 1/23/11 to 1 and 2011). Then by inputting "2011" in B1 and "4" in C1, the function yields the sum of the amounts in April 2011.

    Another benefit to this is the ability to add rows to the table, and have the function update the sum for each month accordingly. This wasn't too hard of a problem, but thanks for your help!

+ 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.2.0