简体   繁体   中英

Not able to repair this formula in Excel

=IF(COUNTIF($E8:$E12+$G8:$M11,"A")+(COUNTIF($E8:$E12+$G8:$M11,"AH")/2)=0,"",COUNTIF($E8:$E12+$G8:$M11,"A")+(COUNTIF($E8:$E12+$G8:$M11,"AH")/2))

I am selecting some cells in Excel and I am calculating value A,AH based on those cells

  • A means 1
  • AH means 0.5.

In theses cells $E8:$E12+$G8:$M11 I am caluclating A AH values in these cells

You cannot simply add ranges. $E8:$E12+$G8:$M11 causes an error.

If ranges F8:F12 and G12:M12 are empty and will always be empty you can simply use $E$8:$M$12 instead of $E8:$E12+$G8:$M11. If this is not possible I would simply use a sum of COUNTIF functions, one for range $E8:$E12 and one for range $G8:$M11.

Also you seem to have a problem of class =if(x=0,something,x) and x is always numeric. If x expression is lengthy, writing it twice might be difficult to read or play with. In such situations I sometimes use =iferror(1/(1/x),something). If x is zero then 1/x results in error, thus "something" is returned, if x is nonzero 1/(1/x) which is simply x is returned.

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