Conditional AVERAGEIFS
Hi Chris,
One way would be to use an array formula.
F G H I J K
2 Year xa xb xc xd
3 1 1.23 1.55
4 2 1.75
5 3 1.90 2.00
6 4 2.20 1.40 2.10
=IF(ISERROR(AVERAGE(IF(Year=$G3,IF(Site=H$2,Value) ))),"",AVERAGE(IF(Year=$G3,IF(Site=H$2,Value))))
In each cell enter the formula above, then finalize it using the CTRL SHIFT
ENTER key combination to make it an array formula.
The If part just checks for divsion by zero errors which occur when there is
no data for that combination of criteria.
Mike
"Chris" wrote:
I have three columns of data, one is years (e.g., 1, 2, 3, 4, etc), one is
sites (e.g., XA, XB, XC, XD, etc), and the other is the values I would like
to average (e.g., 1.2, 1.6, 1.5, 2.1, etc). I have attempted to use criteria
with AVERAGEIFS to average only those values in year 1 at sites XH, XI, XJ,
XK. Here is the function I am using:
=AVERAGEIFS(Sheet3!H:H,Sheet3!C:C,"=1",Sheet3!D:D, "XH",Sheet3!D:D,"XI",Sheet3!D:D,"XJ",Sheet3!D:D,"X K")
However, it returns the #DIV/0! error. What is the appropriate function for
average only the data in year 1 at sites XH, XI, XJ, XK?
Thank you.
|