+ Reply to Thread
Results 1 to 4 of 4

Aggregating costs by date

Hybrid View

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

    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
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    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

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Aggregating costs by date

    Does the attached help

    Regards
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

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

    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.6.0 RC 1