# Average of Last x Instances of a Criteria

#### whothemannow

##### New Member
Hi all,

I am working on a spreadsheet about employee performance, with columns of employee name, month, year, performance, etc. (as a result, employees have multiple rows as the data is sorted by dates). How can I calculate the average of each employee's last 6 performance scores (excluding zeroes)? (so that each row would return that employee's average) I have tried numerous formulas and initially thought that I should use AVERAGEIF, but I can't seem to figure it out.
Any help would be greatly appreciated!

#### whothemannow

##### New Member
Change the 2 after the sequence to 1
It works now, but it doesn't seem to be super consistent, the formula seems to only take into account the first 6 responses, is there a way for it to take into account the last 6? Ideally, it would also be good if zeroes were excluded from the average calculation. Column M in the screenshot below is the value that the formula should return, as opposed to what it does (column L).

#### Attachments

• Annotation 2021-08-03 103936.png
36 KB · Views: 2

### Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use \$ signs: \$V\$2:\$Z\$99 will always point to V2:Z99, even after copying

#### Fluff

##### MrExcel MVP, Moderator
Can you post your sample data.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Replies
8
Views
415
Replies
3
Views
253
Replies
2
Views
182
Replies
19
Views
214
Replies
9
Views
962

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,152,571
Messages
5,770,920
Members
425,652
Latest member
Pemby

### 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.

### Which adblocker are you using?

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

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