Forum Discussion
Elli_viivi
Aug 14, 2023Copper Contributor
Problem with every 5 row average function
Hello! I have a very large table (over 45000 rows so manual calculation is not an option) and I want to calculate the averages for every 5 rows. My data starts at row 2 and the first row is title...
- Aug 14, 2023
Patrick2788 I read the request slightly differently and that they need to average every set of 5 rows (1-5, 6-10, etc...) so I suggest this:
=BYROW(WRAPROWS(values, 5),LAMBDA(vector, AVERAGE(vector)))
Patrick2788
Aug 14, 2023Silver Contributor
I see you're using Excel 365 so there's no need for OFFSET.
Try something like this:
=LET(vector, TAKE(WRAPROWS(values, 5), , 1), AVERAGE(vector))
- mtarlerAug 14, 2023Silver Contributor
Patrick2788 I read the request slightly differently and that they need to average every set of 5 rows (1-5, 6-10, etc...) so I suggest this:
=BYROW(WRAPROWS(values, 5),LAMBDA(vector, AVERAGE(vector)))
- Elli_viiviAug 14, 2023Copper ContributorThank you so much this worked!!!!
And yes I meant average of set of 5 rows 🙂 - Patrick2788Aug 14, 2023Silver Contributor
Either way, Elli_viivi will be able to adapt it to what's needed. As long as OFFSET is not involved!