简体   繁体   中英

Count seperate EXCEL cells if value >0

Background:

This excel is to track the hours someone works and what days. It also needs to track the total days worked in a week.

Requirement:

The 'Total Days' column needs to count the Monday(M) to Sunday (S) columns if they are greater than 0

Previously I had a simple COUNTIF(H6:K6, ">0") or whatever it was, which worked well.

Now the user has added in extra columns for pay and charge rates each day, after the corresponding day, which has thrown the formula off, and the COUNTIF formula wont do the columns separately inside the same formula.

Snippet of excel layout

Also some clarification, In AZ1 for instance I would want it to count H1, K1, N1, etc up to Z1

If anyone could help me work out a formula, that would be great!

COUNTIFS uses AND logic, whereas, you need OR logic. Try something like:

=COUNTIF(A3,">0") + COUNTIF(B3,">0")+...

编辑:由于这不起作用,这应该做的伎俩:

=COUNTIF(H5,">0")+COUNTIF(K5,">0")+COUNTIF(N5,">0")+COUNTIF(Q5,">0")+COUNTIF(T5,">0")+COUNTIF(W5,">0")+COUNTIF(Z5,">0")

Try using the MOD function to determine the stagger of the columns. SUMPRODUCT and ISNUMBER can take care of the rest.

=SUMPRODUCT(NOT(MOD(COLUMN(H:Z)-8, 3))*ISNUMBER(H6:Z6))

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