Sumifs and Countifs limitations with ors and AND: Excel formulas:

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi, below is the current excel formula.
Is there any limitations with Sumifs and Countifs with or combinations
'=SUM(COUNTIFS(B2:B27,"May",C2:C27,{"FEC";"ORANGE"},A2:A27
,{"NY","GA","LA"}))


for exampel if I want it this way {"NY","GA","LA","AZ","TX"})), will it still give me accurate answer?


Thanks in advance.:)
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi,

Could you explain what you're wanting the formula to do? A small example would help.

One thing I did notice is the ";" in
{"FEC";"ORANGE"}. Is there a reason you have used this?

Matty
 
Upvote 0
Yes, Ron adviced that we use ; yesterday. I am trying to add many or condition to one col. to return the result I want if any critiria is met...:)

Thanks again.
 
Upvote 0
I could be wrong, but my understanding is that vertical arrays should be separated by a ";", whereas horizontal arrays should be separated by a ",".

What is the SUM element in the formula you posted supposed to do?

Matty
 
Last edited:
Upvote 0
Matty, thanks again for getting back...
What i want is to count if column b = "May",
Column C = any of either "FEC" or "ORANGE"
Column A any either "NY" or "GA" or "LA" or "AZ" or "TX"...

Thanks again Pedie.:)
 
Upvote 0
Try:

Code:
=SUM(IF(B2:B27="May",IF(ISNUMBER(MATCH(C2:C27,{"FEC","ORANGE"},0)),IF(ISNUMBER(MATCH(A2:A27,{"NY","GA","LA","AZ","TX"},0)),1))))
Array entered...

Matty
 
Upvote 0
Try,

Enter the all value, NY,GA,LA... n a range, say in E2:E6, then

=SUMPRODUCT(COUNTIFS(A2:A27,E2:E6,B2:B27,"May",C2:C27,{"Fec","Orange"}))
 
Upvote 0
Testing which involves two sets of criteria requires a V,H or H,V organization... V stands for vertical and H for horizontal.

V,H as in:

=SUM(COUNTIFS(B2:B27,"May",C2:C27,{"FEC";"ORANGE"},A2:A27,{"NY","GA","LA","AZ","TX"}))

yields an intermeadiate result like:

SUM({1,0,1,0,1;0,1,0,0,0})

H,V as in:

=SUM(COUNTIFS(B2:B27,"May",C2:C27,{"FEC","ORANGE"},A2:A27,{"NY";"GA";"LA";"AZ";"TX"}))

yields an intermeadiate result like:

=SUM({1,0;0,1;1,0;0,0;1,0})

whereas...

V,V and H,H as in:

=SUM(COUNTIFS(B2:B27,"May",C2:C27,{"FEC";"ORANGE"},A2:A27,{"NY";"GA";"LA";"AZ";"TX"}))

=SUM(COUNTIFS(B2:B27,"May",C2:C27,{"FEC","ORANGE"},A2:A27,{"NY","GA","LA","AZ","TX"}))

yield the following intermediate results, respectively:

=SUM({1;1;0;0;0})

=SUM({1,1,0,0,0})

Using a cell range instead of an array constant does not show a different behavior.

Concluding...

I guess H,V or V,H are more often than not the intended behavior.
 
Upvote 0
Hi Aladin,

Thanks for sharing your thoughts.

With array constants such as those pedie is working with, given that they are being applied to Columns of data, I suppose it doesn't matter whether the "," or the ";" delimiter is used, as long as the approach is consistent. Or am I missing something here?

Matty
 
Upvote 0

Forum statistics

Threads
1,223,276
Messages
6,171,138
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top