+ Reply to Thread
Results 1 to 7 of 7

Aray Formula - Sum from a number of OR criteria

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Aray Formula - Sum from a number of OR criteria

    Hi,

    Following array formula sums data for Apple OR Pear. However, it's quite static. For instance if I want to add Orange & Banana , I have to update my formula. Is it possible if I can give my criteria in a range (Yellow) and don't have to update formula?

    {=SUM(IF((A:A="Apple")+(A:A="Pear");B:B;0))}

    Capture.PNG
    Attached Files Attached Files
    1. Reply to thread and inform if suggestion was helpful or not
    2. Click on the star (=Add Reputation) if you think someone helped you
    3. Mark [SOLVED] to this thread if solution was found. (On Menu "Thread Tools" > "Mark this thread as solved")

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Aray Formula - Sum from a number of OR criteria

    Try...

    =SUMPRODUCT(SUMIF(A:A,D2:D13,B:B))
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Re: Aray Formula - Sum from a number of OR criteria

    Great,

    I modified it to so I can use as many criteria as I want:

    {=SUMPRODUCT(SUMIF(A:A;OFFSET($D$1;1;0;COUNTA(D:D)-1;1);B:B))}

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Aray Formula - Sum from a number of OR criteria

    I don't think you need to enter this as an array formula as the Sumproduct is doing that part for you.

    It also might be a good idea to stay away from offset as it's volatile.

    =SUMPRODUCT(SUMIF(A:A,D2:INDEX(D:D,MATCH(REPT("z",255),D:D)),B:B))
    Last edited by jeffreybrown; 11-19-2018 at 11:50 AM.

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Aray Formula - Sum from a number of OR criteria

    Try this

    =SUMPRODUCT((COUNTIF(D2:D13,A1:A12)>0)*(B1:B12))
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Aray Formula - Sum from a number of OR criteria

    Not a Good Idea....

    1. OFFSET is volatile and the formula will recalculate everytime ANYTHING is changed on the sheet.

    2. It isn't an array formula.

    3. Array formulae and SUMPRODUCT don't like whole column ranges and will be slow.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  7. #7
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Re: Aray Formula - Sum from a number of OR criteria

    Thanks all for your support!

+ 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. How to have the formula add or subtract 1 year in a Index -Aray formula
    By Meshell in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-02-2017, 10:59 PM
  2. Filling an aray via vba
    By Excelbat in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-22-2015, 09:52 PM
  3. Lookup partial fit in aray
    By Optim in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-13-2015, 09:53 PM
  4. Aray formula and Zeros
    By cdscivic in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-15-2013, 02:24 PM
  5. [SOLVED] Aray within an array
    By wacky_diva in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-22-2013, 12:49 AM
  6. rearrange an aray
    By fly Catcher in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-20-2008, 03:29 PM
  7. [SOLVED] filling an aray without looping
    By mark@sentryi.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2005, 01:05 PM

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