+ Reply to Thread
Results 1 to 4 of 4

summing arrays..

  1. #1
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2010
    Posts
    291

    summing arrays..

    Heya! Again problem with arrays This question is rather theoretical, and, please, dont solve it other way - what is interesting is that exact point

    When i try to sum an array which is the result of either index or if functions then excel just ignore sum function. so 2 question:

    1. Why?
    2. How to overcome this without changing all these index and if functions.

    The example of the problem is in the attachment. Thanks and regards in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: summing arrays..

    Not really a need for an array formula, but since you specifically requested using an array formula, this will work:

    =SUM(IF(A1:D1="d",A3:D3))

    The reason the other one isn't, is because is only returning the number from a specific column, and no other numbers. You need to eliminate that condition.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: summing arrays..

    Because the structure is incorrect for that. Ultimately you have backended you way into a SUM(IF) situation, for which there is a specific correct syntax, and you're not using it. Just growing a monster formula forever like that isn't all that theoretically useful, my conclusion.

    The array format for your scenario is pretty simple:

    =SUM(IF($A$1:$D$1="d", $A$3:$D$3)) (entered as an array)


    And of course, Excel already has a non-array SUMIF function for this very purpose:

    =SUMIF($A$1:$D$1, "d", $A$3:$D$3)


    And there is even a SUMIFS() function if you need more than one criteria.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: summing arrays..

    You're two guys just brilliant. I mean, simplicity is what rules and is really beautiful, and i need, probably, to reset my mind. Thank you for the lesson!

+ 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