<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Rolling Averages in Excel?</title>
	<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel/</link>
	<description>Comments on Ask MetaFilter post Rolling Averages in Excel?</description>
	<pubDate>Sun, 21 May 2006 09:05:54 -0800</pubDate>
	<lastBuildDate>Sun, 21 May 2006 09:05:54 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Rolling Averages in Excel?</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel</link>	
		<description>Excelfilter: how do I compute a rolling seven-day average for something that happens at sporadic intervals? &lt;br /&gt;&lt;br /&gt; I keep an exercise log and I&apos;d like to have both entries for how much I&apos;m swimming as well as how much swimming I&apos;ve done in the preceding seven days [not like a Sunday to Saturday week, just the last seven days] and how it compares to previous seven day increments. I swim four out of seven days on no particular schedule. My spreadsheet, such as it is, looks like this, with about seven months of data.&lt;br&gt;
&lt;br&gt;
Date&#160;&#160;&#160;            Laps&lt;br&gt;
1/2/06&#160;&#160;&#160;           17&lt;br&gt;
1/3/06&#160;&#160;&#160;           27&lt;br&gt;
1/6/06&#160;&#160;&#160;           24&lt;br&gt;
.                    &#160;&#160;&#160; .&lt;br&gt;
.                    &#160;&#160;&#160; .&lt;br&gt;
.                    &#160;&#160;&#160; .&lt;br&gt;
&lt;br&gt;
I&apos;ve got a chart with daily values over time and a trendline. I&apos;d really like to be able to figure out how to make a chart with just seven day averages, but I&apos;m not sure how to go about it. Most of the examples I&apos;ve seen are for things where there are regular data elements that need to be dealt with, like daily revenues. I&apos;m good with spreadsheets in general, but not super smart with functions so the more explanation the better where functions are involved. Thanks.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.38591</guid>
		<pubDate>Sun, 21 May 2006 08:51:18 -0800</pubDate>
		<dc:creator>jessamyn</dc:creator>
		
			<category>excel</category>
		
			<category>averages</category>
		
			<category>workoutlog</category>
		
	</item> <item>
		<title>By: boo_radley</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596552</link>	
		<description>There&apos;s an option under the Tools &amp;gt; Data analysis. &lt;a href=&quot;http://www.statsclass.com/excel/analyses/bilder/excel_ma.html&quot;&gt;Check out these instructions&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
If you don&apos;t have the Data Analysis option, or want a way to do it while you&apos;re still gathering your data, I might make a new column of data called &quot;Moving average&quot; next to &quot;Laps&quot;. Its entries would look like (assuming your data really starts in cell B2) &lt;code&gt;=Average(B2:B8)&lt;/code&gt;. Copying and pasting that formula into each successive cell in the row will get you your moving average.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596552</guid>
		<pubDate>Sun, 21 May 2006 09:05:54 -0800</pubDate>
		<dc:creator>boo_radley</dc:creator>
	</item><item>
		<title>By: jessamyn</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596561</link>	
		<description>&lt;em&gt;Copying and pasting that formula into each successive cell in the row will get you your moving average.&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
Thank you. I do have the data analysis option, but won&apos;t this just get me the average of the last seven &lt;em&gt;entries&lt;/em&gt; instead of the last seven days? My problem is that some weeks I swim five days and some weeks I swim two. I know that I can make a chart that has every day on it and just fill in the second column for the days I swim, but it seems like Excel knows how to parse dates so that if I could figure out the magic formula, I could avoid this extra work.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596561</guid>
		<pubDate>Sun, 21 May 2006 09:15:59 -0800</pubDate>
		<dc:creator>jessamyn</dc:creator>
	</item><item>
		<title>By: boo_radley</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596581</link>	
		<description>You want it to average for the days that aren&apos;t recorded too? That&apos;s a bit more complex -- it&apos;s hard to consider data that isn&apos;t there.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596581</guid>
		<pubDate>Sun, 21 May 2006 09:49:55 -0800</pubDate>
		<dc:creator>boo_radley</dc:creator>
	</item><item>
		<title>By: Doofus Magoo</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596584</link>	
		<description>This would go better in a database. ;)&lt;br&gt;
&lt;br&gt;
That said, the &quot;simplest&quot; solution would probably be to make judicious use of the SUMIF function. Personally, I&apos;d set it up as follows:&lt;br&gt;
&lt;br&gt;
Assume that your date/laps table is in a range named &quot;MyLaps.&quot;&lt;br&gt;
&lt;br&gt;
Set up a parallel table (in the same sheet, or another sheet, doesn&apos;t matter) with one row per week, each row containing the week start date and week end date (e.g., 1/1/2006 and 1/7/2006) in columns A and B. Then in cell C, put the following formula:&lt;br&gt;
&lt;br&gt;
=(SUMIF(MyLaps,&quot;&amp;gt;=&quot;&amp;amp;A3,B:B)-SUMIF(MyLaps,&quot;&amp;gt;=&quot;&amp;amp;B3,B:B))/(COUNTIF(MyLaps,&quot;&amp;gt;=&quot;&amp;amp;A3)-COUNTIF(MyLaps,&quot;&amp;gt;=&quot;&amp;amp;B3))&lt;br&gt;
&lt;br&gt;
For the first row (1/1/2006 - 1/7/2006), you&apos;re basically saying &quot;Total laps on or after 1/1/2006 MINUS Total laps on or after 1/8/2006 (e.g., total laps from 1/1 - 1/7). Divide by the number of times I did laps during that same interval.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596584</guid>
		<pubDate>Sun, 21 May 2006 09:54:53 -0800</pubDate>
		<dc:creator>Doofus Magoo</dc:creator>
	</item><item>
		<title>By: Doofus Magoo</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596585</link>	
		<description>... the formula posted above assumes that you&apos;re starting your &quot;Weekly Table&quot; on row 3 (i.e., it references cells A3 and B3). Those may need to be corrected if you start your &quot;Weekly Table&quot; in a different row.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596585</guid>
		<pubDate>Sun, 21 May 2006 09:56:14 -0800</pubDate>
		<dc:creator>Doofus Magoo</dc:creator>
	</item><item>
		<title>By: Doofus Magoo</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596591</link>	
		<description>Jeez, sorry -- one more assumption. The formula assumes that your &quot;MyLaps&quot; range is in columns A and B (i.e., references to A:A and B:B).&lt;br&gt;
&lt;br&gt;
I&apos;ll also point out that for your second row in the &quot;Weekly Table,&quot; instead of typing the dates for the second week, you can add 7 to the dates in the first row. That way you can just copy the entire row down for as many weeks as you need to do it.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596591</guid>
		<pubDate>Sun, 21 May 2006 10:00:28 -0800</pubDate>
		<dc:creator>Doofus Magoo</dc:creator>
	</item><item>
		<title>By: jessamyn</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596641</link>	
		<description>Thank you. The assumptions are getting a little ahead of me. Let me make clearer exactly what I have. One worksheet, called &quot;laps&quot;. In column A I have dates I swam, header is &quot;date&quot;. In column B I have number of laps for days I swam. Header is &quot;amount&quot; Column C is blank. In column D and E I now have dates where column D is start of week date and column E is end of week date. Headers are &quot;begin&quot; and &quot;end&quot;&lt;br&gt;
&lt;br&gt;
Doofus, I think I am confused which A and B you mean. When I input the formula you give me, I&apos;m not sure what to change MyLaps to. If I change it to &quot;amount&quot; I get a number that doesn&apos;t seem right [I get 20.2 when that week I only swam 12 and 18 laps] Maybe I&apos;m not as good at Excel as I thought? Given the data I have I&apos;d like to be able to plot what the average laps-per-day I have swum is, and I figured a rolling seven day average was an okay way to do this, but maybe I can do it as just an average year-to-date?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596641</guid>
		<pubDate>Sun, 21 May 2006 11:19:03 -0800</pubDate>
		<dc:creator>jessamyn</dc:creator>
	</item><item>
		<title>By: bim</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596650</link>	
		<description>How about a nice &lt;a href=&quot;http://office.microsoft.com/en-us/results.aspx?Scope=TC%2CHP%2CHA%2CRC%2CFX%2CES%2CEP%2CDC%2CXT&amp;Query=fitness+templates&quot;&gt;excel template.&lt;/a&gt; These are direct from Microsoft, but there are others on the internet. Maybe one will fit your needs and do the work for you.&lt;br&gt;
&lt;br&gt;
Good luck!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596650</guid>
		<pubDate>Sun, 21 May 2006 11:40:06 -0800</pubDate>
		<dc:creator>bim</dc:creator>
	</item><item>
		<title>By: Opposite George</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596654</link>	
		<description>Not answering the original question (it&apos;s doable, but to my knowledge a PITA in Excel) but offering another option.&lt;br&gt;
&lt;br&gt;
You might want to consider comparing each day&apos;s laps to what I&apos;ll call a &quot;moving average with decay&quot; (I&apos;m ignorant of the fancy math name for this technique, if there is one.)  This will smooth out the bumps in your data.&lt;br&gt;
&lt;br&gt;
Add a column -- call it &quot;MAWD&quot; or whatever.  For the first date just enter the same value as the laps entry.  For subsequent dates add 90 percent of the previous MAWD value to 10 percent of that day&apos;s laps -- this value will reflect trends in your performance while not being too affected by one off day (or a day when you pushed yourself extra hard); thus, it should serve as a good benchmark of your progress.  I&apos;ve used this technique before to track my weight and it&apos;s a good way to keep from agonizing over temporary blips.&lt;br&gt;
&lt;br&gt;
Email me if you want a worked-out example in Excel.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596654</guid>
		<pubDate>Sun, 21 May 2006 11:47:15 -0800</pubDate>
		<dc:creator>Opposite George</dc:creator>
	</item><item>
		<title>By: Doofus Magoo</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596716</link>	
		<description>&lt;blockquote&gt;&lt;i&gt;Doofus, I think I am confused which A and B you mean. When I input the formula you give me, I&apos;m not sure what to change MyLaps to. If I change it to &quot;amount&quot; I get a number that doesn&apos;t seem right [I get 20.2 when that week I only swam 12 and 18 laps] Maybe I&apos;m not as good at Excel as I thought? Given the data I have I&apos;d like to be able to plot what the average laps-per-day I have swum is, and I figured a rolling seven day average was an okay way to do this, but maybe I can do it as just an average year-to-date?&lt;/i&gt;&lt;/blockquote&gt;&lt;br&gt;
&lt;br&gt;
Assuming that your &quot;date/amount&quot; data start in A2:B2, and that your &quot;begin/end&quot; data start in D2:E2, then this formula would go in F2:&lt;br&gt;
&lt;br&gt;
=(SUMIF(A:B,&quot;&amp;gt;=&quot;&amp;amp;D2,B:B)-SUMIF(A:B,&quot;&amp;gt;=&quot;&amp;amp;E2,B:B))/(COUNTIF(A:B,&quot;&amp;gt;=&quot;&amp;amp;D2)-COUNTIF(A:B,&quot;&amp;gt;&quot;&amp;amp;E2))</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596716</guid>
		<pubDate>Sun, 21 May 2006 13:16:48 -0800</pubDate>
		<dc:creator>Doofus Magoo</dc:creator>
	</item><item>
		<title>By: Doofus Magoo</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596726</link>	
		<description>Feh, sorry, that should be:&lt;br&gt;
&lt;br&gt;
=(SUMIF(A:B,&quot;&amp;gt;=&quot;&amp;amp;D2,B:B)-SUMIF(A:B,&quot;&amp;gt;&quot;&amp;amp;E2,B:B))/(COUNTIF(A:B,&quot;&amp;gt;=&quot;&amp;amp;D2)-COUNTIF(A:B,&quot;&amp;gt;&quot;&amp;amp;E2))&lt;br&gt;
&lt;br&gt;
(changed the second &quot;&amp;gt;=&quot; to just &quot;&amp;gt;&quot;)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596726</guid>
		<pubDate>Sun, 21 May 2006 13:29:42 -0800</pubDate>
		<dc:creator>Doofus Magoo</dc:creator>
	</item><item>
		<title>By: devilsbrigade</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#596733</link>	
		<description>I&apos;m going to second the database opinion. This would be very easy with SQL, and most tools have an option to import CSV data.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-596733</guid>
		<pubDate>Sun, 21 May 2006 13:38:01 -0800</pubDate>
		<dc:creator>devilsbrigade</dc:creator>
	</item><item>
		<title>By: kindall</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#597028</link>	
		<description>You have all the weekly data -- the days when you didn&apos;t swim, the number of laps is zero. So fill in the zeroes and the rest of it will be easy. Your weekly average will be much lower than the number of laps you swim on any given day, of course, but that doesn&apos;t matter, as it won&apos;t affect your ability to see trends.&lt;br&gt;
&lt;br&gt;
It&apos;ll also make any weeks you slacked off and didn&apos;t swim 4 days stand out in your graph quite starkly...</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-597028</guid>
		<pubDate>Sun, 21 May 2006 20:17:22 -0800</pubDate>
		<dc:creator>kindall</dc:creator>
	</item><item>
		<title>By: Opposite George</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#597033</link>	
		<description>Probably late to the party here, but you can implement &lt;b&gt;Doofus Magoo&lt;/b&gt;&apos;s method without plugging in start/end dates, and just adding one column to your original table:&lt;br&gt;
&lt;br&gt;
Say the dates are in column A, and laps are in column B.  We&apos;ll put the moving average in column C.  Say your first data row is row 3.  Put this formula in cell C4:&lt;br&gt;
&lt;br&gt;
=SUMIF(A$3:A3;&quot;&amp;gt;=&quot;&amp;amp;A4-7;B$3:B3)/COUNTIF(A$3:A3;&quot;&amp;gt;=&quot;&amp;amp;A4-7)&lt;br&gt;
&lt;br&gt;
Copy this formula down the column.  Voila.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-597033</guid>
		<pubDate>Sun, 21 May 2006 20:28:21 -0800</pubDate>
		<dc:creator>Opposite George</dc:creator>
	</item><item>
		<title>By: Opposite George</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#597038</link>	
		<description>BTW, that gives you avg. laps / session over the previous 7 days.  If you&apos;d prefer to get &lt;b&gt;kindall&lt;/b&gt;&apos;s number (avg. laps per day over previous seven days,) just throw the COUNTIF part out, and divide by 7.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-597038</guid>
		<pubDate>Sun, 21 May 2006 20:31:24 -0800</pubDate>
		<dc:creator>Opposite George</dc:creator>
	</item><item>
		<title>By: Doofus Magoo</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#597203</link>	
		<description>&lt;blockquote&gt;&lt;i&gt;=SUMIF(A$3:A3;&quot;&amp;gt;=&quot;&amp;amp;A4-7;B$3:B3)/COUNTIF(A$3:A3;&quot;&amp;gt;=&quot;&amp;amp;A4-7)&lt;/i&gt;&lt;/blockquote&gt;&lt;br&gt;
&lt;br&gt;
The elegance of this solution appeals to me greatly (as OG pointed out, this will give you more of a true &quot;moving average&quot; over the last seven days instead of averaging by arbitrary calendar weeks); I think it may be a bit inaccurate, however.&lt;br&gt;
&lt;br&gt;
Having not had my daily allotment of coffee, I may be off-base, but as written, however, it looks like OG&apos;s formula will give you the &quot;average laps swum since one week before this date&quot; since it doesn&apos;t include an upper bound on the dates. That is, for lap records from January, it will average laps from January - present. For lap records from July 2004, it will average laps from July 2004-present. For the most recent week, however, the average will be valid.&lt;br&gt;
&lt;br&gt;
If you want to look at the average between dates X and Y, I&apos;m pretty sure you have to use two COUNTIF/SUMIF statements; e.g. the following formula in cell C3:&lt;br&gt;
&lt;br&gt;
=(SUMIF(A:A,&quot;&amp;gt;=&quot;&amp;amp;(A3-7),B:B)-SUMIF(A:A,&quot;&amp;gt;&quot;&amp;amp;A3,B:B))/(COUNTIF(A:A,&quot;&amp;gt;=&quot;&amp;amp;A3-7)-COUNTIF(A:A,&quot;&amp;gt;&quot;&amp;amp;A3))</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-597203</guid>
		<pubDate>Mon, 22 May 2006 03:58:54 -0800</pubDate>
		<dc:creator>Doofus Magoo</dc:creator>
	</item><item>
		<title>By: Opposite George</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#597386</link>	
		<description>&lt;b&gt;Doofus Magoo&lt;/b&gt;, &lt;br&gt;
&lt;br&gt;
I haven&apos;t had my morning coffee yet either, so no guarantees here but yes, our formulas give different results but not for the reason you think; it looks like your formula is actually calculating an eight-day moving average, including the date in A3.  &lt;br&gt;
&lt;br&gt;
Add an equals sign to your second compare and our formulas will agree.  At least that&apos;s how it worked out on my spreadsheet.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-597386</guid>
		<pubDate>Mon, 22 May 2006 09:06:09 -0800</pubDate>
		<dc:creator>Opposite George</dc:creator>
	</item><item>
		<title>By: Doofus Magoo</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#597454</link>	
		<description>You&apos;re right. But wouldn&apos;t we want instead to either change the &quot;A3-7&quot; to &quot;A3-6&quot; or the first &quot;&amp;gt;=&quot; to &quot;&amp;gt;&quot; (that is, for laps on Saturday, we want to look backwards to Sunday, not to the previous Saturday)? By changing the &quot;&amp;gt;&quot; to &quot;&amp;gt;=&quot; we&apos;re excluding the current day&apos;s laps from the week&apos;s average.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-597454</guid>
		<pubDate>Mon, 22 May 2006 10:22:17 -0800</pubDate>
		<dc:creator>Doofus Magoo</dc:creator>
	</item><item>
		<title>By: Opposite George</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#597595</link>	
		<description>Whether you include the current day in the week&apos;s average is strictly a matter of taste.  &lt;br&gt;
&lt;br&gt;
Today&apos;s laps make up 25% of the number calculated using the second method, so my feeling is that a comparison between that and today&apos;s number gives you less information than one between today&apos;s laps and the seven days leading up to today.  Plus, the second method keeps the historical data separate from today&apos;s data, which is easier for me to wrap my head around.&lt;br&gt;
&lt;br&gt;
Ultimately, there is no single &quot;right&quot; way.  This exercise really is one of decreasing a complex series&apos; information content sufficiently that we can draw simple conclusions with our puny human brains.  The key is understanding what goes into the smushed numbers we end up with so our interpretations make sense.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-597595</guid>
		<pubDate>Mon, 22 May 2006 12:28:22 -0800</pubDate>
		<dc:creator>Opposite George</dc:creator>
	</item><item>
		<title>By: jessamyn</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#597675</link>	
		<description>I tried both OG and DMs solutions and for some reason I get an error in Excel when I try &lt;a href=&quot;http://ask.metafilter.com/mefi/38591#597033&quot;&gt;this one&lt;/a&gt; but the longer one (the eight day average) seem to work and do what I&apos;d like it to do. You can see the new chart here&lt;br&gt;
&lt;br&gt;
&lt;img src=&quot;http://www.librarian.net/tempo/laps.jpg&quot;&gt;&lt;br&gt;
&lt;br&gt;
Where the yellow line is the trend line, the orange line is just the raw laps data and the red line is the average over eight days which is a little more useful and a little less all over the place. If anyone can show me how to troubleshoot OGs function (or feel free to email me) that would be super. Thanks very much.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-597675</guid>
		<pubDate>Mon, 22 May 2006 13:36:14 -0800</pubDate>
		<dc:creator>jessamyn</dc:creator>
	</item><item>
		<title>By: jessamyn</title>
		<link>http://ask.metafilter.com/38591/Rolling-Averages-in-Excel#602352</link>	
		<description>I could have also checked that there weren&apos;t &lt;a href=&quot;http://www.usms.org/fitness/content/vscomplogs&quot;&gt;swim logs&lt;/a&gt; available elsewhere. While these don&apos;t do exactly what I want, it&apos;s good to see them available.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.38591-602352</guid>
		<pubDate>Fri, 26 May 2006 16:04:23 -0800</pubDate>
		<dc:creator>jessamyn</dc:creator>
	</item>
	</channel>
</rss>
