简体   繁体   中英

Count Rows in Excel on condition<a>AND {condition<b> OR condition<c>}

no matter how hard I reconfigure COUNTIF and COUNTIFS I can't get the output to work, here is a table example :

在此处输入图片说明

I cannot get a function that will count Where Severity = High AND (Customer !="" OR Case Info !="")

In the table example I should get a return of 5.

The closest I have got so far is with =COUNTIFS('8.2'!C:C," High ",'8.2'!A:A,"<>",'8.2'!B:B,"<>"), But that only returns 3.

What excel function could do what I need?

With COUNTIFS() you will need to do three:

=COUNTIFS(C:C,"High",A:A,"<>")+COUNTIFS(C:C,"High",B:B,"<>")-COUNTIFS(C:C,"High",A:A,"<>",B:B,"<>")

Or as XORLX showed:

=SUM(COUNTIFS(C:C,"High",A:A,{"<>","","<>"},B:B,{"","<>","<>"}))

But this requires that the cells be true blank, no formulas that return and empty string

在此处输入图片说明


SUMPRODUCT is slightly shorter but it requires that you specify the data range to avoid unnecessary iterations as it is an array type formula:

=SUMPRODUCT((C2:C17="high")*((A2:A17<>"")+(B2:B17<>"")-((A2:A17<>"")*(B2:B17<>""))))

Or this one by XORLX, who has forgotten more about excel formulas than I will ever know:

=SUMPRODUCT((C1:C20="high")*((A1:A20<>"")+(B1:B20<>"")>0))

在此处输入图片说明

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