ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   sumif 2 text conditions (https://www.excelbanter.com/excel-worksheet-functions/92437-sumif-2-text-conditions.html)

Ted Metro

sumif 2 text conditions
 
In column A I have employee names, in coolumn B I have country names, and in
column C, I have department.

I want to do a sumif for example that would count how many people in the
United States are in the Sales department.

I've tried an array formula something like this, but it's not working,

{sum(if(and(b2:b100="United States",c2:c100="Sales"),1,0))}

Any ideas?

Dave Peterson

sumif 2 text conditions
 
=sumproduct(--(b2:b100="united states"),--(c2:c100="sales"))

Adjust the ranges to match--but you can't use whole columns.

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html

Ted Metro wrote:

In column A I have employee names, in coolumn B I have country names, and in
column C, I have department.

I want to do a sumif for example that would count how many people in the
United States are in the Sales department.

I've tried an array formula something like this, but it's not working,

{sum(if(and(b2:b100="United States",c2:c100="Sales"),1,0))}

Any ideas?


--

Dave Peterson

Ron Coderre

sumif 2 text conditions
 
Try this:


=SUMPRODUCT((b2:b100="United States")*(c2:c100="Sales"))
or...this variation:
=SUMPRODUCT(--(b2:b100="United States"),--(c2:c100="Sales"))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Ted Metro" wrote:

In column A I have employee names, in coolumn B I have country names, and in
column C, I have department.

I want to do a sumif for example that would count how many people in the
United States are in the Sales department.

I've tried an array formula something like this, but it's not working,

{sum(if(and(b2:b100="United States",c2:c100="Sales"),1,0))}

Any ideas?



All times are GMT +1. The time now is 06:54 PM.

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