I’m fairly inexperienced with excel so this might be a bit of a basic question but I can’t seem to find the answer anywhere.

I have several rows, one is an “index” row while the others contain values. I want to get the averages for each row based on the indexes (average for each index).

I’ve been looking at the IF function inside an AVERAGE function but I can’t seem to figure out the proper syntax so I’m wondering if it is even possible?

I attempted to do it like so for a single average: `=AVERAGE(IF(A3:J3=0;A5:M5;0))`

.

Straight away I can see a couple of problems. First for each positive conditional I am saying to use the entire row (I don’t know how to map one row to another) as a result. Secondly for each negative conditional I provide a 0 rather than ignoring that value.

From where I’m standing it doesn’t seem like what I need is possible to do…am I correct?

You can combine `SUMIF`

and `COUNTIF`

functions to get the average:

```
=SUMIF(A1:K1,1,A2:K2) / COUNTIF(A1:K1, 1)
```

would give the average you want for index 1 (in row 1, columns A through K), values in row 2.

### Answer：

Have a look at the `AVERAGEIF`

function. Something like

```
=AVERAGEIF(A$1:K$1,1,$A2:$K2)
```

should do what you want.

Tags: excelexcel