COUNTIF using multiple columns if one meets the criterion

Airfix9

Well-known Member
Joined
Sep 23, 2005
Messages
886
Hi all,

Having a senior moment.

What I have is a list of outlets in column A and then, in columns B, C and D a 1 if they stock a particular model (one column for each model).

What I want to do is to count the number of times that an outlet stocks at least one of the models. That is to say, if the sum of columns B, C and D is 1 or more, count it.

Ideas greatly received.
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

MrKowz

Well-known Member
Joined
Jun 30, 2008
Messages
6,653
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Try:

=SUMPRODUCT(--((B1:B100+C1:C100+D1:D100)>=1))
 

Airfix9

Well-known Member
Joined
Sep 23, 2005
Messages
886
Thanks guys. I adapted Mr Kowz's formula as follows:

=SUMPRODUCT(--((INDIRECT("'"&A9&"'!B3:B1000")+INDIRECT("'"&A9&"'!C3:C1000")+INDIRECT("'"&A9&"'!D3:D1000"))>=1)*--(INDIRECT("'"&A9&"'!A3:A1000")<>""))

Where A9 contains the country name of the sheet I am looking at and I then used the final look at column A to avoid the totals (the number of rows could change but would never be more than 1000).

Thanks for your swift help.
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
Your formula should work OK as it is...... but note that it's bad practice to use *-- in any formula

Either use a syntax like

=SUMPRODUCT((A2:A10="x")*(B2:B10="y"))

or

=SUMPRODUCT(--(A2:A10="x"),--(B2:B10="y"))
 

Watch MrExcel Video

Forum statistics

Threads
1,123,330
Messages
5,601,000
Members
414,419
Latest member
JRDunya

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