+ Reply to Thread
Results 1 to 7 of 7

SUM based on two conditions in an array with varying lengths

  1. #1
    Registered User
    Join Date
    12-06-2012
    Location
    portland
    MS-Off Ver
    Excel 2007
    Posts
    11

    SUM based on two conditions in an array with varying lengths

    Hi, I am new to forum and just realzied I had posted my question in another post, so I am posting a new thread. Is there anyway to delete my posts that are in the other one?

    Here is my issue (example attached). I am trying to sum multiple data based on multple conditions. In my example work book, I need the output to look at the month in cell N5 and then return the sum of all the data from the array that has the same code as in column K.

    I have been able to get a function that gives me the first number that meets the criteria, but not the sum.

    Your help or guidance would be great!
    Attached Files Attached Files

  2. #2
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: SUM based on two conditions in an array with varying lengths

    Try this:

    =SUMPRODUCT(($E$5:$H$5=$N$5)*($C$7:$C$15=K7)*($E$7:$H$15))

    - Moo

    * Note: You could also use SUMIFS to do this same calculation, however, I am working on a computer that uses Excel 2004 Mac, and SUMIFS isn't available in this version.
    Last edited by Moo the Dog; 12-06-2012 at 03:19 PM. Reason: Added note about SUMIFS

  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: SUM based on two conditions in an array with varying lengths

    Alternatively, try this array formula in N7

    Please Login or Register  to view this content.
    Confirm with Ctrl+Shift+Enter and not just Enter

    Copy down
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  4. #4
    Registered User
    Join Date
    12-06-2012
    Location
    portland
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: SUM based on two conditions in an array with varying lengths

    Thank you, for some reason this works perfect in my example, but when I put it into my acutal spreadsheet I get an #N/A or #Value!.

    The array I am selecting has other numbers that do not have codes, will this matter?

  5. #5
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: SUM based on two conditions in an array with varying lengths

    Other numbers without codes shouldn't matter. The formulas are specifically looking for rows with the specific code, and the column with the specific date.

    If you are getting errors, perhaps you could upload your actual sheet (remove any confidential information first) so we can try to find the problem.

    - Moo

  6. #6
    Registered User
    Join Date
    12-06-2012
    Location
    portland
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: SUM based on two conditions in an array with varying lengths

    Ok here is my full sheet. Trying to get the formula to work on the "Monthly Report Outputs" tab.

    Any thougths?
    Attached Files Attached Files
    Last edited by jd354; 12-06-2012 at 04:12 PM.

  7. #7
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: SUM based on two conditions in an array with varying lengths

    Sorry about the delay... was away from my computer for a while.

    You're going to have to go with the array formula, proposed by Ace_XL, modified like this (put this in E13 on your Output sheet):
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    That can be pasted to the 3 rows below it.

    If you're not familiar with Array Formulas, do this:
    1. Copy formula above
    2. Select cell E13 on the 'Output' sheet and delete everything in the cell
    3. With cell E13 still selected, click in the formula bar and paste the formula above (the one you just copied)
    4. Hold down the Ctrl and Shift keys and hit Enter

    You will then be able to copy that cell, and paste it down in the other rows below.

    - Moo

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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