I am trying to make an average of multiple cells, and I want to ignore to zero cells.
Here is my formula
=IFERROR(AVERAGEIF(L4:L10;L12:L18;L20:L26;L28:L34;L36:L37);"") and I don’t know where to put the condition to ignore zero
"<>0" . Am I doing something wrong?
Assuming you only have positive values and zeroes you can average without zeroes, for non-contiguous ranges using this syntax
FREQUENCY part gives you a two element array, one being the count of zeroes, the other the count of positive values,
INDEX then retrieves the second of those (the number of positive values), so if you divide the sum by that count you get the average excluding zeroes.
FREQUENCY function (unlike
AVERAGEIF) accepts a non contiguous range argument (a “union”)
….but if you can identify which rows to exclude by using values in another column then it’s easier with
AVERAGEIFS, e.g. if on the excluded rows, e.g. in
K35 etc. they all have the value “Total” you can use this version:
adjust depending on the exact text, wildcards are possible
Here is another way using
Values 1 -3 0 5 777 3 0 0 8 text 4 5 6 0 6 7
B18=SUMIF(A2:A17,"<>0",A2:A17)-SUM(A6,A11,A15) B19=COUNTIF(A2:A5,"<>0")+COUNTIF(A7:A10,"<>0")+COUNTIF(A12:A17,"<>0") B20=B18/B19