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!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi

Countif won't do it but SUMPRODUCT will.

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

Tony
 
Upvote 0
=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}
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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