+ Reply to Thread
Results 1 to 8 of 8

Sumproduct or sumif

  1. #1
    Forum Contributor
    Join Date
    10-15-2013
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    218

    Sumproduct or sumif

    Hello All,

    I have in column D... variables such as "AD, IR, OA, OE, SA, SD, UR, XD".

    I would like to sum everything to the right of the column (E:AA) that match "AD" and "OE" in column D. This is what i have...

    =SUM(SUMIF('BG WC'!D:D,{"AD,"OE"},'BG WC'!E:AA))

    but I keep getting an error...

    Any help is appreciated.

    Thanks!

  2. #2
    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: Sumproduct or sumif

    Please upload an example workbook and manually add the results you expect to see. It's not clear whether you're looking for a single cell formula for the sum of a 2 dimensional range or a formula on each row of a 2D range
    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.

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Sumproduct or sumif

    I'm taking a stab at this but =SUMPRODUCT((E1:K5)*(D1:D5="AD"))

    Assuming you have 5 rows
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sumproduct or sumif

    With the SUMIF function all the ranges have to be the same size (99.99999999%) of the time.

    You can use SUMPRODUCT.

    =SUMPRODUCT(ISNUMBER(MATCH('BG WC'!D2:D100,{"AD","OE"},0))*'BG WC'!E2:AA100)

    You should avoid using entire columns as references in the SUMPRODUCT function. Use smaller specific ranges.
    Last edited by Tony Valko; 05-11-2016 at 05:02 PM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Sumproduct or sumif

    Richard is correct, it's all guesswork without a sample, but you can use dflak's structure effectively, or the one below was my guess:

    =SUM((E:AA)*(--('BG WC'!D:D="AD")))+SUM((E:AA)*(--('BG WC'!D:D="OE")))

    Whatever formula you use, you'd be wise to use your actual number of rows rather than the entire column (e.g. D1:D512 instead of D:D)

    EDIT: I should note, this is an array formula, use Ctrl + Shift + Enter
    Last edited by CAntosh; 05-11-2016 at 05:03 PM.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Sumproduct or sumif

    The best way to deal with variable rows of data is to convert the range to an Excel Table. Tables know how many rows they have and you can use column header names in the formulas. So when you add or delete data to a table, you do not have to change the formulas that reference the table.

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

    Re: Sumproduct or sumif

    Try this ARRAY formula. Pl see file.
    Please Login or Register  to view this content.
    ARRAY formula is used

    To enter ARRAY formula
    Paste the formula
    Press F2
    Press Ctrl+Shift+Enter keys together.
    formula will be covered with{} brackets.
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,908

    Re: Sumproduct or sumif

    Or try this ...
    =SUMPRODUCT((('BG WC'!D2:D100="AD")+('BG WC'!D2:D100="OE"))*'BG WC'!E2:AA100)

+ 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. Replies: 0
    Last Post: 08-17-2012, 02:02 PM
  2. SUMIF vs SUMPRODUCT
    By EAGLEBUCKS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2011, 05:12 PM
  3. Sumproduct? Sumif?
    By Joey5105 in forum Excel General
    Replies: 2
    Last Post: 06-04-2009, 05:09 PM
  4. [SOLVED] sumif and sumproduct together
    By tina in forum Excel General
    Replies: 3
    Last Post: 03-16-2006, 08:55 PM
  5. sumif or sumproduct
    By Jim in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-06-2006, 09:10 AM
  6. [SOLVED] HELP!!!! sumif or sumproduct ??? :(
    By Wally in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  7. HELP!!!! sumif or sumproduct ??? :(
    By Wally in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  8. SUMPRODUCT OR SUMIF
    By Sean in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2005, 10:06 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