Create a dynamic rolling trailing 7-day average that auto updates

excelquestions1234

New Member
Joined
Aug 28, 2015
Messages
3
I am creating a dashboard and I want it to automatically create a 7-day trailing average based off the the =today() cell that it looks up on.

So I have the raw data in a sheet that has the data by day:

8/1/20158/2/20158/3/20158/4/20158/5/20158/6/20158/7/20158/8/2015
People196184561398288268249203
Cost$35,170$31,451$54,573$50,740$45,846$45,037$41,599$36,590
Orders Cost$179.44$170.93$97.28$127.49$159.19$168.05$167.06$180.25
Average Revenue$414$438$859$688$572$549$538$460

<tbody>
</tbody>

I have a lookup in another sheet that dynamically can update the cell:

TOPLINE8/8/2015
People203
Cost$36,590
Orders Cost$180.25
Average Revenue$460

<tbody>
</tbody>

The formula looks like this: =vlookup(A3,'Raw Data'!$A$1:$AF$40,match($D$1,'Raw Data'!$B$1:$JL$1,0),False)

How do I do this same thing for the trailing 7-day average as well as the previous 2 same DoW (-7days -14 days)?


TOPLINE8/27/2015Trailing 7-Day Avg.Previous 2 DoW
People203????
????​
Cost$36,590????
????​
Orders Cost180.25
Average Revenue$460

<tbody>
</tbody>
 

bstory84

Active Member
Joined
Oct 31, 2011
Messages
403
I think i may have something for you.
You should be able to use the AverageIfs function.
So I made some assumptions.... Sorry if the references are incorrect. but i duplicated what was on your post and i tested. So here you go.
My assumptions are that..
1. Dates are in ROW 1 of worksheet Raw Data.
2. Value titles are in Column A of worksheet Raw Data(People, Cost, ...)

=AVERAGEIFS(INDIRECT("'Raw Data'!"&MATCH($A2,'Raw Data'!$A$1:$A$5,0)&":"&MATCH($A2,'Raw Data'!$A$1:$A$5,0)),'Raw Data'!$1:$1,">="&TODAY()-6,'Raw Data'!$1:$1,"<="&TODAY())
 

excelquestions1234

New Member
Joined
Aug 28, 2015
Messages
3
I think i may have something for you.
You should be able to use the AverageIfs function.
So I made some assumptions.... Sorry if the references are incorrect. but i duplicated what was on your post and i tested. So here you go.
My assumptions are that..
1. Dates are in ROW 1 of worksheet Raw Data.
2. Value titles are in Column A of worksheet Raw Data(People, Cost, ...)

=AVERAGEIFS(INDIRECT("'Raw Data'!"&MATCH($A2,'Raw Data'!$A$1:$A$5,0)&":"&MATCH($A2,'Raw Data'!$A$1:$A$5,0)),'Raw Data'!$1:$1,">="&TODAY()-6,'Raw Data'!$1:$1,"<="&TODAY())
All the references you made are correct but It does not seem to be working for me. Any idea why?
 

bstory84

Active Member
Joined
Oct 31, 2011
Messages
403
The Category names would have to match exactly. So "People" would not match to "people" . So make sure those are the same. Also make sure your dates are actually numbers formatted as dates, and are not strings "text" If you would like please reply back telling me how the data is stores. IE.. what columns and or rows and worksheet names the data exists in.
 

excelquestions1234

New Member
Joined
Aug 28, 2015
Messages
3
The Category names would have to match exactly. So "People" would not match to "people" . So make sure those are the same. Also make sure your dates are actually numbers formatted as dates, and are not strings "text" If you would like please reply back telling me how the data is stores. IE.. what columns and or rows and worksheet names the data exists in.
Thanks for your help! I got it to work. Really appreciate it.

For the past 2 same day of week would it look like this:
=AVERAGEIFS(INDIRECT("'Raw Data'!"&MATCH($A3,'Raw Data'!$A$1:$A$46,0)&":"&MATCH($A3,'Raw Data'!$A$1:$A$46,0)),'Raw Data'!$1:$1,"="&TODAY()-7,'Raw Data'!$1:$1,"="&TODAY()-14)
 

Forum statistics

Threads
1,081,617
Messages
5,360,049
Members
400,565
Latest member
Tommy O

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top