Last n values of an AVERAGEIF formula

johnog

New Member
Joined
Nov 8, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi Team,

I have the following, which works great

=AVERAGE(IF('Raw stats'!O:O=A8,'Raw stats'!AH:AH))

however, I'm wanting another formula for the average of the last n occurrences of this on the raw stats tab.

I've tried a few things and come up short. Any help would be great.

Cheers,
Johno
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Welcome to the Forum!

Try: =AVERAGE(TAKE(FILTER('Raw Stats'!AH:AH,'Raw Stats'!O:O=A8),-N))

I have assumed that "last" means those towards the bottom (e.g. rather than needing to check an attached date in some other column?).

If the formula finds fewer than N occurrences, it will average them. If you want a result only if there are at least N, we can adapt the formula.
 
Last edited:
Upvote 0
Solution
Thanks very much for the welcome and the answer! Some quick sanity checks shows this is exactly what I was after.

Thanks again,
Johno
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

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