Graham C1600

Board Regular
Joined
Feb 17, 2018
Messages
96
Office Version
  1. 365
Hi,

Is it possible to to use 2 x array formulas in the same function. I.e. {=sum(countifs(range,{"text","text"},range,{"text","text"}))}

I'm trying but it's only picking up the first text from the second array.

Any ideas ?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
A
B
C
D
E
1
NameAge
2
John
32​
2​
3
Jennifer
23​
4
Eric
41​
5
Sheet: Sheet36

Array formula in cell D2:
=SUM(COUNTIFS(A2:A4,{"John","Eric"},B2:B4,{32,41}))

My formula seems to work?
 
Upvote 0
For all possible combinations of those, you need to alter the orientation of one of the arrays, like this:

=sum(countifs(range,{"text","text"},range,{"text";"text"}))

By the way, that formula does not need to be array entered, as they are array constants.
 
Upvote 0
Try swapping the 32 and 41 around in the cells and you'll get 0 rather than the desired 2.

Sorry, I was as clear as mud. The COUNTIFS function counts records or rows if all criteria match. There is no matching record if I swap 32 and 41.

Example


A
B
C
D
E
F
1
NameAgeCriteria1Criteria2
2
John
32​
John
41​
3
Jennifer
23​
Eric
32​
4
Eric
41​
5
0​
6
Sheet: Sheet36

Array formula in cell D5:
=SUM(COUNTIFS(A2:A4,D2:D3,B2:B4,E2:E3))
 
Upvote 0
This should work in such cases

=SUM(COUNTIFS(A2:A4,D2:D3,B2:B4,TRANSPOSE(E2:E3)))
 
Upvote 0
I believe the intent was to match on either value in each column. So per your example, to match if the name is John or Eric and if the age is 32 or 41; not to match John and 41, or Eric and 32.
 
Upvote 0
My original ask was to look up values in 1 column (perhaps 2 or 3 values) and then the same again in another column. So looking in multiple columns for multiple data.

So would
=sum(countifs(range,{"text","text"},range,{"text"
;
"text"}))
work in my question by just changing the , for a ; in the second part of the formula ?
 
Upvote 0
It would only take a moment to find out... ;)
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,695
Members
448,979
Latest member
DET4492

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