Microsoft Office Forums laregest 30 consecutive average of values in a 180 cell range
 Register FAQ Search Today's Posts Mark Forums Read

#1
10-01-2017, 07:05 AM
 mreynolds1775 Windows 10 Office 2013 Novice Join Date: Sep 2017 Posts: 12
laregest 30 consecutive average of values in a 180 cell range

Good morning all,

I am looking to find the highest 30 day average of sales within a 180 range. I already track total sales by month, but as an example, this doesn't work as an accurate depiction. Example: first half of Aug sales were low, second half were high; first half of September sales were high, and the second were low. The period from mid august to mid September was the highest sales period.

any clue how to find this info? thanks in advance.

-Mike
#2
10-01-2017, 07:55 AM
 Pecoflyer Windows 7 64bit Office 2010 64bit Moderator Join Date: Nov 2011 Location: Brussels Belgium Posts: 2,146

Please post a sample sheet with some data and expected results - Thx
__________________
Problem solved ? Let others know by clicking " Thread Tools" then " Mark thread as solved".( This can be undone if need be)
#3
10-01-2017, 09:10 AM
 mreynolds1775 Windows 10 Office 2013 Novice Join Date: Sep 2017 Posts: 12

Peco,

Thanks. Please see attached example. Highlighted cell represents the desired result. I want this to be an automated so that I can determine worst case scenario for demand of an item.

Initially, I had thought that using =average(Large(range{1,2,3,4,5,...30})) would do the trick, but that will give me the average of the 30 highest days of sales, not the highest 30 days of sales....make sense?

-Mike
Attached Files
 high average sales over large range.xlsx (11.3 KB, 4 views)
#4
10-01-2017, 11:15 AM
 ArviLaanemets Windows 8 Office 2016 Expert Join Date: May 2017 Posts: 286

I can see only 2 possible solutions:
1. A VBA script which reads 180 days data into array, and runs a 150-step cycle, calculates an average (there is a shortcut when you save before the first value in cycle, so you can deduce it in next cycle and add a new last value instead) for every step, and when this is more than max average until this step, saves the new max value into variable(s) or another array (probably you need period start and end dates too), or into predefined Name;
2. A separate table with columns PeriodStart and PeriodEnd which are calculated for first row as (TODAY() - 180 +ROW() - X) AND (TODAY() - 180 + ROW() - X) + 30, where X is the number of row for 1st period. For every next row, the period shifts 1 day, and you'll have 150 rows of data in this table. In 3rd column, average for period is calculated from your data table (Using SUMIFS() formulas). And then you can calculate max average using MAX() function on column with averages (calculate it as Name - then it will be much easier to use it in formulas).
#5
10-01-2017, 10:56 PM
 xor Windows 10 Office 2016 Expert Join Date: Oct 2015 Posts: 883

I am not sure, but you can try to take a look at row 14 in the attached file.

Cell B14 shows the average sales for first 30 days, cell C14 shows average sales for 02-jan-17 to 31-jan-17 and so on.
Attached Files
 high average sales over large range_2.xlsx (16.5 KB, 3 views)
#6
10-01-2017, 11:09 PM
 Pecoflyer Windows 7 64bit Office 2010 64bit Moderator Join Date: Nov 2011 Location: Brussels Belgium Posts: 2,146

Quote:
 Originally Posted by mreynolds1775 but that will give me the average of the 30 highest days of sales, not the highest 30 days of sales....make sense?
Not really
__________________
Problem solved ? Let others know by clicking " Thread Tools" then " Mark thread as solved".( This can be undone if need be)
#7
10-02-2017, 05:23 AM
 ArviLaanemets Windows 8 Office 2016 Expert Join Date: May 2017 Posts: 286

My version how to do it
Attached Files
 Sales.zip (30.2 KB, 4 views)
#8
10-02-2017, 06:28 AM
 mreynolds1775 Windows 10 Office 2013 Novice Join Date: Sep 2017 Posts: 12

Quote:
 Originally Posted by ArviLaanemets My version how to do it

I apologize, but cannot open the zip file on my computer. Any chance in attaching the file direct?
#9
10-02-2017, 07:22 AM
 ArviLaanemets Windows 8 Office 2016 Expert Join Date: May 2017 Posts: 286

OK, it looks like our firewall let it through!

Btw, 7Zip is free, and allows to pack and unpack various formats.
Attached Files
 Sales.xlsx (36.2 KB, 3 views)

Last edited by ArviLaanemets; 10-02-2017 at 07:23 AM. Reason: Edit
#10
10-16-2017, 10:12 AM
 kvsrinivasamurthy Windows XP Office 2007 Novice Join Date: Oct 2017 Posts: 1

If start date is 1/1/17 formula is

=LARGE((SUMIF(OFFSET(\$B\$2,0,ROW(\$1:\$180)-ROW(\$1:\$1),1,30),">0")/30),1)

ARRAY formula is used

To enter ARRAY formula
Paste the formula
Press F2
Press Ctrl+Shift+Enter keys together.
formula will be covered with{} brackets by excel.
Attached Files
 high average sales over large range ans.xlsx (11.8 KB, 0 views)
#11
10-19-2017, 04:03 AM
 Debaser Windows 7 64bit Office 2010 32bit Competent Performer Join Date: Oct 2015 Posts: 155

Non-array formula:

=MAX(INDEX(SUBTOTAL(1,(OFFSET(\$B\$2,0,COLUMN(\$B\$2:\$ AE\$2)-2,1,30))),))

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post FUGMAN Excel Programming 7 02-05-2017 08:37 AM Michael Labuschagne Excel 2 12-08-2016 06:35 AM rick10r Excel 1 07-05-2016 12:07 PM aligahk06 Excel 1 09-15-2010 08:17 AM virencm Word 0 08-06-2010 06:10 PM

All times are GMT -7. The time now is 10:28 PM.

 -- Default Style -- Mobile Style Contact Us - Privacy Statement - Top