简体   繁体   中英

Excel 2010 COUNTIF AND OR

I'm creating a report where I need to count all entries where (column a = x or column b = x or column c = x) and (column d <> x or y or z)

I'm open to any solutions scripted or expression.

Thank you.

_t

You can use the following array formula, just adjust the variables "X, Y, Z" to whatever you criteria you need it to be and change the range to fit your range of data.

=COUNTIF(A1:A10,"X")+COUNTIF(B1:B10,"X")+COUNTIF(C1:C10,"x")+SUM((D1:D10<>"X")*(D1:D10<>"Y")*(D1:D10<>"Z"))

You have to press CTRL + SHIFT + Enter to calculate this array formula, will not work with a standard enter.

=sumproduct(NOT(NOT(((A:A="X")+(B:B="X")+(C:C="X"))))*((D:D<>"X")*(D:D<>"Y")*(D:D<>"Z)))

This is with the assumption that an entire row is considered the entry not each individual cell.

This can be computationally intensive with full column reference. Better if used over a defined range.

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