#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default variable average

I've got a spreadsheet linked to Access which pulls in a year's worth of
actual sales numbers (of products). I need to figure the average sales over
either the past 3 or 6 or 12 months. The number of months to base the average
on is part of the query. Is there a way to write the "=average" formula to
look to the cell w/ the number of months to use and then average on the past
3/6/12 months based on what's in that cell?
I can send a sample spreadsheet to anyone who thinks they can help.
thanks much, Sue in Illinois
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default variable average

Try this array formula

=AVERAGE(IF(B2:B200=EOMONTH(TODAY(),-F1-1)+1,A2:A200))

where F1 holds the number of months.

Commit the formula with Ctrl-Shift-Enter, not just Enter

--
__________________________________
HTH

Bob

"Sue in Illinois" wrote in message
...
I've got a spreadsheet linked to Access which pulls in a year's worth of
actual sales numbers (of products). I need to figure the average sales
over
either the past 3 or 6 or 12 months. The number of months to base the
average
on is part of the query. Is there a way to write the "=average" formula to
look to the cell w/ the number of months to use and then average on the
past
3/6/12 months based on what's in that cell?
I can send a sample spreadsheet to anyone who thinks they can help.
thanks much, Sue in Illinois



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default variable average

Bob
Got the #NAME? error - Column E holds the "number of months to look back"
and the actual quantities for 2008 run from Column F thru Column Q, with the
average trend running from Column R thru Column AC (Jan-Dec, 2009). If the
number of months in Col E is 3, then starting w/ R the formula needs to
average O/P/Q; and in Col S average P/Q/R. I've got the formula in all
columns & just changed the cell range. My need is that if the boss wants to
change the number of months from 3 to 6, I want to be able for one of us to
just change the number in Col E and have the formula recalculate - rather
than having to go thru Cols R thru AC & change the range.
Thanks for your quick response!
Sue Hallwas

"Bob Phillips" wrote:

Try this array formula

=AVERAGE(IF(B2:B200=EOMONTH(TODAY(),-F1-1)+1,A2:A200))

where F1 holds the number of months.

Commit the formula with Ctrl-Shift-Enter, not just Enter

--
__________________________________
HTH

Bob

"Sue in Illinois" wrote in message
...
I've got a spreadsheet linked to Access which pulls in a year's worth of
actual sales numbers (of products). I need to figure the average sales
over
either the past 3 or 6 or 12 months. The number of months to base the
average
on is part of the query. Is there a way to write the "=average" formula to
look to the cell w/ the number of months to use and then average on the
past
3/6/12 months based on what's in that cell?
I can send a sample spreadsheet to anyone who thinks they can help.
thanks much, Sue in Illinois




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default variable average

EOMONTH is from the Analysis Toolpak (ATP). Do you have it installed (check
ToolsAddins)?

--
__________________________________
HTH

Bob

"Sue in Illinois" wrote in message
...
Bob
Got the #NAME? error - Column E holds the "number of months to look back"
and the actual quantities for 2008 run from Column F thru Column Q, with
the
average trend running from Column R thru Column AC (Jan-Dec, 2009). If the
number of months in Col E is 3, then starting w/ R the formula needs to
average O/P/Q; and in Col S average P/Q/R. I've got the formula in all
columns & just changed the cell range. My need is that if the boss wants
to
change the number of months from 3 to 6, I want to be able for one of us
to
just change the number in Col E and have the formula recalculate - rather
than having to go thru Cols R thru AC & change the range.
Thanks for your quick response!
Sue Hallwas

"Bob Phillips" wrote:

Try this array formula

=AVERAGE(IF(B2:B200=EOMONTH(TODAY(),-F1-1)+1,A2:A200))

where F1 holds the number of months.

Commit the formula with Ctrl-Shift-Enter, not just Enter

--
__________________________________
HTH

Bob

"Sue in Illinois" wrote in
message
...
I've got a spreadsheet linked to Access which pulls in a year's worth
of
actual sales numbers (of products). I need to figure the average sales
over
either the past 3 or 6 or 12 months. The number of months to base the
average
on is part of the query. Is there a way to write the "=average" formula
to
look to the cell w/ the number of months to use and then average on the
past
3/6/12 months based on what's in that cell?
I can send a sample spreadsheet to anyone who thinks they can help.
thanks much, Sue in Illinois






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Average: 2nd argument as a variable in another cell av(c6:c(a3)) Tony the Tiger Excel Discussion (Misc queries) 2 May 5th 08 12:39 AM
Average the last eight or nine (Variable) numbers in a row. Michael Excel Discussion (Misc queries) 3 December 11th 07 09:55 PM
How to average one constant # to variable #s? A1:A2 A1:A3 A1:A4 Colfax Excel Worksheet Functions 1 March 2nd 06 02:49 AM
average last 17 cells (variable) brian thompson3001 via OfficeKB.com New Users to Excel 11 November 18th 05 02:39 AM
average last 17 cells (variable) brian thompson3001 via OfficeKB.com New Users to Excel 1 November 17th 05 06:18 PM


All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"