Improve SUMIF function to sum more than one column

M

Mark Rucker

In using the SUMIF function in Excel, I wanted to sum values in more than one
column, but it would only sum the first column.

Desired Function
=SUMIF(F16:F21,"A",G16:H21)

Workaround
=SUMIF(F16:F21,"A",G16:G21)+=SUMIF(F16:F21,"A",H16:H21)

Mark


----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...dg=microsoft.public.excel.worksheet.functions
 
B

Bob Phillips

One way

=SUM(IF(F16:F21="A",G16:H21,0))

which is an array formula, so commit with Ctrl-Shift-Enter

--
HTH

Bob Phillips

Mark Rucker said:
In using the SUMIF function in Excel, I wanted to sum values in more than one
column, but it would only sum the first column.

Desired Function
=SUMIF(F16:F21,"A",G16:H21)

Workaround
=SUMIF(F16:F21,"A",G16:G21)+=SUMIF(F16:F21,"A",H16:H21)

Mark


----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/com...dg=microsoft.public.excel.worksheet.functions
 
H

Harlan Grove

Bob Phillips wrote...
One way

=SUM(IF(F16:F21="A",G16:H21,0))

which is an array formula, so commit with Ctrl-Shift-Enter
....

And another that's not an array formula,

=SUMPRODUCT((F16:F21="A")*G16:H21)

or, getting tricky,

=SUMPRODUCT(SUMIF(F16:F21,"A",OFFSET(G16:G21,0,{0,1})))

which can handle multiple NONADJACENT columns in the same
worksheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top