Average separated array

Jabe

New Member
Joined
Apr 29, 2024
Messages
7
Office Version
  1. 365
Platform
  1. Windows
1000017249.jpg

Hi,

Please see attached example. In the numbered columns I will put the marks for completed assignments. I would like to create a rolling average of the last 5 assignment scores. However, I need to keep the Intervention and Notes columns after each block of 5 assignments for a separate utility. Is there a way to average the last 5 values ignoring the Intervention and Notes columns?
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hello, would this work for you:

Excel Formula:
=IFERROR(AVERAGE(TAKE(FILTER(C3:T3,(ISNUMBER($C$2:$T$2)=TRUE)*(ISBLANK(C3:T3)=FALSE)),,-5)),"")
 
Upvote 0
How about
Excel Formula:
=AVERAGE(TAKE(TOROW(CHOOSECOLS(B3:T3,XMATCH(SEQUENCE(,15),$B$2:$T$2)),1),,-5))
 
Upvote 0
Hi hagia_sofia - yes that appears to work,
I assume though you changed the ranges to start at column B, not column C?

If interested, that formula can be shortened to
Excel Formula:
=IFERROR(AVERAGE(TAKE(FILTER(B3:T3,ISNUMBER(B$2:T$2)*(B3:T3<>""),""),,-5)),"")
I'm also not sure you need the IFERROR wrapping as that would mean you didn't have any data at all to average for that row.
 
Upvote 0
Another option:

Excel Formula:
=AVERAGE(TAKE(TOROW(HSTACK(B3:F3,I3:M3,P3:T3),1),,-5))
 
Upvote 0
Solution
I assume though you changed the ranges to start at column B, not column C?

If interested, that formula can be shortened to
Excel Formula:
=IFERROR(AVERAGE(TAKE(FILTER(B3:T3,ISNUMBER(B$2:T$2)*(B3:T3<>""),""),,-5)),"")
I'm also not sure you need the IFERROR wrapping as that would mean you didn't have any data at all to average for that row.
Thanks Peter. When I used the version you suggested I get a blank cell - could that be because there are less than 5 values in my array or is there something else?
 
Upvote 0
Thanks for the feedback!
I'm not entirely sure what happened, but when I tried to drag-copy the formula to other rows some of the results were (very) wrong (when checked manually) while others worked - so not sure if this formula works when copying for a larger dataset
 
Upvote 0
When I used the version you suggested I get a blank cell - could that be because there are less than 5 values in my array or is there something else?
Must be something else - could be that the 'numbers' in row 2 (or at least some of them) are not actually numbers but text values.
Anyway, you have a solution that does not depend on that. :)
 
Upvote 0

Forum statistics

Threads
1,221,526
Messages
6,160,340
Members
451,637
Latest member
hvp2262

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