Excel XP and forumula using =COUNTIF with AND

berenger123

New Member
Joined
Feb 17, 2004
Messages
3
I don't know if this can be done, but I want 2 conditions used in a COUNTIF statement. Ex: =COUNTIF(A1:A10,"=TRUE)AND(B10:B20,"=Accounting")

Is there a way to make a statement similar to this work? I can get either statement to work separately, but not compoundly!
 

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Hi

Countif won't do it but SUMPRODUCT will.

=SUMPRODUCT(--(A1:A10,"=TRUE),--(B10:B20,"=Accounting"))

Tony
 

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,014
=SUMPRODUCT((A1:A10)*(B1:B10="Accounting"))

Welcome to the board and search for SUMPRODUCT and you'll find magic you never thought possible.

{Edit}In addition to not being on the same rows, your ranges are not the same size. So I think I misunderstood this at first pass. The formula above would count instances where A=TRUE AND B="Accounting" on the same (relative) row (the rows don't have to be the same, but the "offsets" are, first & first, second & second and so forth). If you want to count up all the cases where A=TRUE and B = "Accounting", period (relationship between A and B is irrelevant) then =SUMPRODUCT((A1:A10)+(B1:B10="Accounting")) {/Edit}
 

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Oops

Should be
=SUMPRODUCT(--(A1:A10=TRUE),--(B10:B19="Accounting"))
or
=SUMPRODUCT(--(A1:A10=TRUE),--(B11:B20="Accounting"))

The range sizes must be the same and syntax mistype.

Tony
 

berenger123

New Member
Joined
Feb 17, 2004
Messages
3
This is great! I never would have throught of the SUMPRODUCT expression. Thanks for saving so much time
 

Watch MrExcel Video

Forum statistics

Threads
1,123,052
Messages
5,599,511
Members
414,315
Latest member
Yolanda5050

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
Top