0

I want to take the average of rows which would result in a column (array). Example input:

3 4

4 4

4 6

With an array formula I want to create:

3.5

4

5

4 Answers 4

4

The average is the sum of numbers divided by the count of that numbers. So first add them (A1:A3+B1:B3)
3+4 = 7
4+4 = 8
4+6 = 10
Then divide by the number of numbers(/2):
7/2 = 3.5
8/2 = 4
10/2 = 5

{=(A1:A3+B1:B3)/2}

edit after comment from op:
formula for addition without adding column manually from https://productforums.google.com/forum/#!topic/docs/Q9x44sclzfY

{=mmult(A1:B3,sign(transpose(column(A1:B3))))/Columns(A1:B3)}
1
  • I mean to use only array A1:B3 as input otherwise it does not work for my purpose.. :(
    – BigChief
    Commented Aug 12, 2014 at 9:10
1

This is one way to do that in Excel

=SUBTOTAL(1,OFFSET(A1:B3,ROW(A1:B3)-MIN(ROW(A1:B3)),0,1))

OFFSET supplies an "array of ranges", each range being a single row, and SUBTOTAL with 1 as first argument, averages each of those ranges. You can use this in another formula or function or entered in a range on the worksheet.

The advantage over Siphor's suggestion with MMULT is that this will still work even with blanks or text values in the range (those will be ignored)

1

Excel for 365 and Excel Online have the BYROW and BYCOL functions now. To perform the same function as above, just use the following formula:

=BYROW(A1:B3, LAMBDA(row, AVERAGE(row)))

BYROW function - Microsoft Support

To put it simply, the BYROW and BYCOL functions apply the supplied LAMBDA function to each row in the array. In this case, the provided LAMBDA function applies the AVERAGE function to each of its inputs. Since BYROW supplies each row of the array, AVERAGE is applied to each row.

-1

If first column is A and the second is B, then enter this formuls in column C:

=AVERAGE(A1,B1)

and extend it to the last row

Also you can use a range if you have more than 2 columns (this function allows for some cells to be empty):

 =AVERAGE(A1:F1)
1
  • sorry I mean i want to use an array formula for this which calculates per row the average and stores it in a new array... (selecting the two columns as input and using CTRL+SHIFT+ENTER to generate the last column)
    – BigChief
    Commented Aug 12, 2014 at 8:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.