简体   繁体   中英

Excel counting cells based on complex criteria

Hate asking question about something as simple as an Excel formula, but seem to really need and would appreciate the help.

I have a table where the rows headings contains names and the column headings contains week numbers. Within this table I have differents numbers. Both numbers that are plus and negatives.

I want to count each cell where the row heading matches a specific name and then each cell that has a plus value with a week number less than or equal to a certain week.

I have tried to got it to work with at least some function (without it caring about plus and negative values) but haven't even gotten that to work.

I've tried with:

=SUMPRODUCT((Data!F3:F28=I1)*(Data!I2:BI2="<="&A1)*(Data!I3:BI28))
=SUMIFS(Data!I3:BI28;Data!F3:F28;I1;Data!I2:BI2;"<="&A1)

   

.............1 2 3 4 5

name1 -1 4 3 1 1

name2 0 0 0 0 0

I want a formula that counts for example every column header with a value less than or equal to (for example) 4, but excludes negatives and vice versa. So for the example above, the result of name1 should be 8; counts week 2, 3 and 4.

For your current example:

在此处输入图像描述

Formula in H3 :

=SUMPRODUCT((B2:F3>=0)*(B1:F1<=4)*(A2:A3="name1"),B2:F3)

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