ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   SUM IF with conditions in another column (https://www.excelbanter.com/excel-discussion-misc-queries/123249-sum-if-conditions-another-column.html)

EJ

SUM IF with conditions in another column
 
I've been using =SUMIF(C$5:C$317,"0.5") - column C can contain any value
between 1 and 50 or text and I need the sum of any numerical values, but I
only need it to use this if cells in column B meet a particular criteria.


bj

SUM IF with conditions in another column
 
=sumif(b5:b317,criteria,c5:c17)

Check also sumproduct() for more complicated structures

=sumproduct(--(and(b5:b317=criteria1,b5:b317=criterian2)),--(c5:c3170.5),c5:c317)
as an example

"EJ" wrote:

I've been using =SUMIF(C$5:C$317,"0.5") - column C can contain any value
between 1 and 50 or text and I need the sum of any numerical values, but I
only need it to use this if cells in column B meet a particular criteria.


Bob Phillips

SUM IF with conditions in another column
 

"bj" wrote in message
...
Check also sumproduct() for more complicated structures

=sumproduct(--(and(b5:b317=criteria1,b5:b317=criterian2)),--(c5:c3170.5),c5:c317)



You don't do ANDs in SP like that, you use

--(B5:B317=criteria1),--(B5:B317=criteria2)

but that is actually nonsensical because a cell cannot be two different
values, so you probably mean OR, wich is done as

=SUMPRODUCT(--((B5:B317=criteria1)+(B5:B317=criteria2)),--(C5:C3170.5),C5:C317)




All times are GMT +1. The time now is 02:21 AM.

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