Average of first 4 cells that have a value

Mariyka1

New Member
Joined
Nov 1, 2016
Messages
44
I have a worksheet that looks similar to the below - the data-set is very large so I just need to be able to create a single formula to take the average of the first 4 values in that row. some at the beginning are blank - I want the formula to ignore blank and take the average of the first four values. I know there is an average formula that ignores blanks - but I just don't know how I can constrict this formula to only take the first 4 values down to about 500k of rows.


JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberNovemberDecember
2010407070306070302010
3050802508050250802050
5040105040403004000
3012010120405020400
50504050503050
504012050404020

<colgroup><col width="64" span="11" style="width:48pt"> </colgroup><tbody>
</tbody>
you help is very much appreciated!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Array formula:

=AVERAGE(INDEX($A2:$K2, SMALL(IF($A2:$K2>0, COLUMN($A2:$K2), ""), 4)):INDEX($A2:$K2, SMALL(IF($A2:$K2>0, COLUMN($A2:$K2), ""), 1)))

Ctrl+Shift+Enter
 
Upvote 0
Another option:
Also an array formula that must be entered with CTRL-SHIFT-ENTER.
Excel Workbook
ABCDEFGHIJKL
1JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberNovemberDecemberAverage
2201040707030607030201035
33050802508050250802050102.5
4504010504040300400037.5
5301201012040502040070
65050405050305047.5
750401205040402065
Sheet
 
Upvote 0
Thank you, although unfortunately it did not give me the average of the first 4 values in each row - it was closer to the average of the first 38 columns (out of a total of 117 columns)
 
Upvote 0
Thank you!! this worked perfectly :)


Another option:
Also an array formula that must be entered with CTRL-SHIFT-ENTER.

ABCDEFGHIJKL
1JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberNovemberDecemberAverage
2201040707030607030201035
3 3050802508050250802050102.5
4504010504040300400037.5
5 301201012040502040070
6 5050405050305047.5
7 50401205040402065

<colgroup><col style="width:30px; "><col style="width:64px;"><col style="width:77px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:85px;"><col style="width:77px;"><col style="width:79px;"><col style="width:66px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
L2{=AVERAGE(OFFSET(A2:K2,,MATCH(TRUE,ISNUMBER(A2:K2),0)-1,,4))}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
You're welcome. Thanks for the feedback. I tried the formula by Tom_Jones and it worked for me.
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,546
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top