+ Reply to Thread
Results 1 to 7 of 7

SUMIF function - can it sum multiple columns

  1. #1
    Registered User
    Join Date
    01-18-2007
    Posts
    16

    SUMIF function - can it sum multiple columns

    I have the following table:

    A B C D
    Cash 5 7 3
    Cash 1 2 9
    Cash 4 6 6

    I've tried using the following formula, thinking it would give me a result of 43.

    =SUMIF('Sheet1'!A:A,"=Cash",'Sheet 1'!$B:$D)

    But it's only giving me the sum of B (in this example, 10). What am I doing wrong?

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    =SUMPRODUCT((A1:A10="Cash")*(B1:D10))
    Note Sumproduct won't work for whole column unless using 2007

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    The size of the sum range with SUMIF is always the same size as the criteria range, even if you specify it differently, so your formula will only sum the values in column B.

    You could use

    =SUMPRODUCT(('Sheet1'!A1:A100="Cash")*'Sheet1'!$B1:$D100)

    or

    =SUM(IF('Sheet1'!A1:A100="Cash",'Sheet1'!$B1:$D100))

    The latter is an "array formula" which needs to be confirmed with CTRL+SHIFT+ENTER

    Note: in both cases you need to specify a range rather than using the whole column (unless you're using Excel 2007)

    The latter formula will still give you a result if you have text anywhere in the sum range, the former will give an error in that situation

  4. #4
    Registered User
    Join Date
    01-18-2007
    Posts
    16
    I'm getting a #VALUE error with the sumproduct function

    I get a zero value if i do the Sum(if()

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Quote Originally Posted by sarabella
    I'm getting a #VALUE error with the sumproduct function

    I get a zero value if i do the Sum(if()
    As per my post above #VALUE! error indicates, probably, that you have text in the sum range (text includes "formula blanks") so you probably need to use SUM(IF.....

    You need to confirm the formula with CTRL+SHIFT+ENTER. To do that select cell with formula, press F2 then hold down CTRL and SHIFT keys and press ENTER. Curly braces like { and } should appear around the formula in the formula bar and you should get the correct result

  6. #6
    Registered User
    Join Date
    01-18-2007
    Posts
    16
    Thanks! That was my problem.

    Reading is fundamental.

  7. #7
    Registered User
    Join Date
    04-17-2015
    Location
    Hanoi, Vietnam
    MS-Off Ver
    Microsoft Office 2013
    Posts
    10

    Re: SUMIF function - can it sum multiple columns

    Good info, thanks. this is tutorial video How to use Sum, Sumif, Sumifs functions in Excel
    https://www.youtube.com/watch?v=ZG510NTT3Bk

    or you can use SUMPRODUCT instead of SUMIF, watch: Excel's Sumif and Sumproduct with multiple criteria
    https://www.youtube.com/watch?v=6l5wpZrVvT0
    Last edited by huyle2103; 08-24-2015 at 10:42 AM.
    Tips Excel: http://goo.gl/EXAjwP

+ 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