简体   繁体   中英

Count occurance of text with 2 conditions over multiple worksheets in excel

I have a workbook in which I want to count the number of currence of a text and split this between different values. I'll explain with pictures below:

I have different worksheets with the following appearance: 在此处输入图片说明

The workbook contain a master sheet where I want to summarize the number of OK, errors and not run split between the values in the last column. My master sheets looks like this: 在此处输入图片说明

What i've done so far is to Count the number of occurance of LOE1, LOE2 etc with =SUMPRODUCT(COUNTIF(INDIRECT("'"&"Test - 1"&"'!J5:J99");J2)) but im experiancing two problems with this:

  1. The count is not split on the second argument, ei OK, error not run
  2. I've only been able to count this on one sheet. If I try to use a interval of sheets ('Test - 1:Test - 3' or using insert->name-Define) which is supposed to work according to my google hits it gives me #Value or #Error

I'm currently using excel 2003

Your formula should work OK with a list of sheetnames, eg list all the worksheet names somewhere on the worksheet - name that list Sheetlist and use this version

=SUMPRODUCT(COUNTIF(INDIRECT("'"&Sheetlist&"'!J5:J99");$J2))

Note: no quotes around Sheetlist

To accommodate the extra condition use COUNTIFS, eg with OK/Error etc. in column F

=SUMPRODUCT(COUNTIFS(INDIRECT("'"&Sheetlist&"'!J5:J99");$J2;INDIRECT("'"&Sheetlist&"'!F5:F99");K$1))

COUNTIFS requires Excel 2007 or later - in Excel 2003 you can use this version

=SUM((T(INDIRECT("'"&Sheetlist&"'!J"&TRANSPOSE(ROW($5:$99))))=J$2)*(T(INDIRECT("'"&Sheetlist&"'!F"&TRANSPOSE(ROW($5:$99))))=K$1))

which is an "array formula" which needs to be confirmed with CTRL + SHIFT + ENTER

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM