ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Improve SUMIF function to sum more than one column (https://www.excelbanter.com/excel-worksheet-functions/39730-improve-sumif-function-sum-more-than-one-column.html)

Mark Rucker

Improve SUMIF function to sum more than one column
 
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/comm...et.f unctions

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" <Mark wrote in message
...
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/comm...et.f unctions



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.


Aladin Akyurek

I16:

=G16+H16

Then invoke:

=SUMIF(F16:F21,"A",I16:I21)

Mark Rucker wrote:
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/comm...et.f unctions



All times are GMT +1. The time now is 03:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com