+ Reply to Thread
Results 1 to 5 of 5

Sum if with array (sumprod?)

  1. #1
    Registered User
    Join Date
    04-05-2017
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    4

    Sum if with array (sumprod?)

    hello,

    I'm simply trying to add values next to cells containing a string of character. I'd like it to be usable in the future as in whenever you add a category or a new value within the categories it still works. So instead of A B C I could have hundreds of entries as to not want to do them one by one.

    Cat1 is yellow and should give 51 but I have 32 (which is the sum of As only) and same for cat2 with FFs being 5 instead of 11.

    The bottom part is where the results would be. The red background is what I tried so far to no avail while the green and yellow are the desired result.
    Also, if I'd add D under Cat1 I would like Cat1 to include B9 as well (and any other D that gets added later) so new result would be 61.

    Can array be used like that at all? They aren't of the same size at all which might be why sumprod doesn't work?

    thanks
    Attached Files Attached Files
    Last edited by Socks Wielder; 05-22-2017 at 04:59 PM. Reason: solved

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: Sum if with array (sumprod?)

    You have the 'array of arrays' issue - very hard or impossible to use single cell formulas, but you can use columns of helper formulas, or you can use a UDF, as in the attached.
    Attached Files Attached Files
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sum if with array (sumprod?)

    Perhaps I've misunderstood the question, as I can't see Bernie's "array of arrays issue".

    =SUMPRODUCT(SUMIF(A1:A9,"*"&Categ1&"*",B1:B9),0+(Categ1<>""))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  4. #4
    Registered User
    Join Date
    04-05-2017
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    4

    Re: Sum if with array (sumprod?)

    Quote Originally Posted by XOR LX View Post

    =SUMPRODUCT(SUMIF(A1:A9,"*"&Categ1&"*",B1:B9),0+(Categ1<>""))

    Regards
    This worked perfectly! thanks! I'll have to try and understand why now . Never would have thought of using both sumproduct and sumif at the same time myself.

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Sum if with array (sumprod?)

    You're welcome!

    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. adding criteria to sumprod to countif
    By 13lack13lade in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-25-2014, 10:39 PM
  2. [SOLVED] sumprod + offset issue
    By jw01 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-19-2013, 09:18 AM
  3. Replies: 4
    Last Post: 03-30-2012, 07:55 AM
  4. sumprod mistery
    By pupcis in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-28-2011, 11:38 AM
  5. Using Variable as Column Reference in SumProd
    By Engineers2008 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-08-2010, 06:17 PM
  6. sumprod of arrays of variable length
    By jmwismer in forum Excel General
    Replies: 5
    Last Post: 11-03-2007, 07:21 PM
  7. Excel sumprod formula
    By Engineers08 in forum Excel General
    Replies: 3
    Last Post: 08-10-2007, 09:37 AM

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