I need to calculate an average of 5 cells, but if a cell is blank or zero, it should neglect this value.
I am not able to get it to work with
=AVERAGEIFS(A10;B13;C5;D6;D8;"<>0")
Does anyone know the correct way to calculate this?
=AVERAGEIF(A1:A11,"<>0") This formula eliminates zero values as a result of the criteria expression and Blank cells as default functionality of AVERAGEIF function, so it only counts cells in Excel average without zeros and average if not blank.
Blank data values The AVERAGE, AVERAGEIF, and AVERAGEIFS function all automatically ignore blank cells (and cells that contain text values), so there is no need to provide criteria to filter out empty cells.
To exclude outlying data from an average, you can use the TRIMMEAN function. This function excludes a specific percentage of data points from the top and bottom of the data set, then returns the average (mean) of the remaining data points.
The Excel AVERAGEIF function calculates the average of numbers in a range that meet supplied criteria. AVERAGEIF criteria can include logical operators (>,<,<>,=) and wildcards (*,?) for partial matching. Get the average of numbers that meet criteria.
For an average of non-contiguous values, excluding any zeroes, try this formula
=IFERROR(SUM(A10;B13;C5;D6;D8)/((A10<>0)+(B13<>0)+(C5<>0)+(D6<>0)+(D8<>0));0)
or assuming no negative values you can use this
=IFERROR(SUM(A10;B13;C5;D6;D8)/INDEX(FREQUENCY((A10;B13;C5;D6;D8);0);2);0)
I used semi-colon delimiters as per question, change to commas if your regional settings demands
You are looking for "Averageif":
Specifically, you want to use the range that includes possible blanks and then for the criteria use ">0"
=AVERAGEIF(C1:C5,">0")
In the comments for this answer is a discussion about localization. My locale is United States (Excel 2010), so my delimiter between values passed to a function is the comma ,
Performing an averageif function on non-contiguous ranges is possible:
=AVERAGEIF(B1:B1:B3:B3:B5:B5:B7:B7,">0")
For your locale, you might need to adjust delimiters, but the key thing is for the selection of individual cells, use the format "C1:C1:D4:D4" for the individual cells C1 and D4. The engine must be parsing the references as pairs.
I found myself working on something that I wanted to compute a formula only with the cells that are not empty. To accomplish this, I used the following:
=IF(COUNT(DATA),COMPUTE(DATA),"")
(where COMPUTE
is the formula or computation you want to make, and DATA
is the selection of data you have--in my case a column of data).
To make sure the cells are empty/zero/something when not a "normal value" you can use something like: =IF(CONDITION,NORMAL VALUE,"")
Example:
=IF(SUM(DATA)=0,"",SUM(DATA))
This will only sum the data if it is non-zero, and other cells will see this cell as blank when the data is zero.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With