# 7-Day Rolling Average, Based on Date in P1

#### surkdidat

##### Active Member
Hi

In Column P I have a date (ie 1 March 2021)

In column B (starting in B4:B100) - counting downwards, so the most recent date is in B4 - 23 March 2021 to B100 21 December 2020)

In Column C I have figures corresponding to those dates

I want it to look up the date in P1, and then reference that to column B's dates, and then use the figure in Column C and calculate the average

 P1 01 March 2021 AVERAGE :25 (Average of 10, 18, 36, 42, 37, 19, 13)

 B4 23 March 2021 42 B5 22 March 2021 36 .... .... ...... B27 01 March 2021 10 B28 28 February 2021 18 B29 27 February 2021 36 B30 26 February 2021 42 B31 25 February 2021 37 B32 24 February 2021 19 B33 23 February 2021 13 B34 22 February 2021 17

### Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

#### jasonb75

##### Well-known Member
This is how I would do it in office 365.
Excel Formula:
``=AVERAGE(INDEX(C4:C100,SEQUENCE(7,,MATCH(P1,B4:B100,-1))))``
If you have an older version of excel then you will need a different formula. Please click on your username at the top right of the page then update your account details to show the correct version of excel that you are using.

#### surkdidat

##### Active Member
This is how I would do it in office 365.
Excel Formula:
``=AVERAGE(INDEX(C4:C100,SEQUENCE(7,,MATCH(P1,B4:B100,-1))))``
If you have an older version of excel then you will need a different formula. Please click on your username at the top right of the page then update your account details to show the correct version of excel that you are using.
Hi - apologies updated - am on Excel 2016

#### jasonb75

##### Well-known Member
In that case, try
Excel Formula:
``=AVERAGE(OFFSET(\$C\$4,MATCH(P1,\$B\$4:\$B\$100,-1)-1,0,7,1))``

#### surkdidat

##### Active Member
In that case, try
Excel Formula:
``=AVERAGE(OFFSET(\$C\$4,MATCH(P1,\$B\$4:\$B\$100,-1)-1,0,7,1))``
Thanks very much, very helpful.... Tried to get my head around OFFSET without success, so will delve into the formula later so I can understand what it is doing, and not just putting the solution in my sheet without understanding how it works!

Replies
13
Views
171
Replies
6
Views
114
Replies
2
Views
107
Replies
0
Views
128
Replies
3
Views
43

1,129,395
Messages
5,636,057
Members
416,895
Latest member
SteveRandall

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

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