=IF(AND formula over several worksheets

Friede

New Member
Joined
Sep 25, 2011
Messages
6
Dear all,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
I have a excel file with over 190 worksheets. I want to make a summary sheet, in which one cell counts the answers over all sheets if in each sheets one cell shows a 1 and another cell shows a two. With the if and function I can do it for each sheet.
<o:p></o:p>
=IF(AND(B8=1;B9=2);1;0)
<o:p></o:p>
Does somebody know how I can do it with a matrix function over several worksheets?
<o:p></o:p>
Thanks in advance for your answer.
 
Last edited:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Welcome to the board!

This appears to work with a quick test.

Go to name manager and create a new name,

Name:- Sheets

Refers to:- =GET.WORKBOOK(1)

Then use the formula

=SUMPRODUCT(--(COUNTIF(INDIRECT("'"&Sheets&"'!B8"),1)),--COUNTIF(INDIRECT("'"&Sheets&"'!B9"),2))

to get your result.
 
Upvote 0
Thx a lot for your quick reply. Still it does not work properly. I need to count how many of my respondents indicated two specific anwers to two questions. If they answered the first question with a 1 and the second with a 2 the summary sheet should count that as one and this over 190 sheets. I tried to do it with your version and changed it to:

=SUMPRODUCT((COUNTIF(INDIRECT("Respondent"&ROW(1:6)& "!B8");1));COUNTIF(INDIRECT("Respondent"&ROW(1:6)& "!B9");2))

But it did not work. It would be great if you could help me again.
 
Upvote 0
=SUMPRODUCT(--(COUNTIF(INDIRECT("Respondent"&ROW(1:6)& "!B8");1));--(COUNTIF(INDIRECT("Respondent"&ROW(1:6)& "!B9");2)))

But that only refers to 6 sheets, not 190+ !?
 
Last edited:
Upvote 0
Welcome to the board!

This appears to work with a quick test.

Go to name manager and create a new name,

Name:- Sheets

Refers to:- =GET.WORKBOOK(1)

Then use the formula

=SUMPRODUCT(--(COUNTIF(INDIRECT("'"&Sheets&"'!B8"),1)),--COUNTIF(INDIRECT("'"&Sheets&"'!B9"),2))

to get your result.
NB...

=GET.WORKBOOK(1) returns ALL sheets including the Summary sheet. If the Summary sheet just happens to meet those conditions it will get included in the count.

Also, if the formula is enterd in either cell B8 or B9 on the Summary sheet then you'll get a circular reference.
 
Upvote 0
Dude you are my hero!!! Yes true that was a test for 6 sheets but then it will also work for 190+. Thanks a lot Great job.

BR Friede
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,575
Members
449,089
Latest member
Motoracer88

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