extraordinary average formula !!

gaftalik

Well-known Member
Joined
Feb 6, 2003
Messages
521
Office Version
  1. 2016
Platform
  1. Windows
Hello everybody!

1)Is there any formula to put in K6 which may calculates the average of the last 3 months ! should it be a macro or a formula ?
I need also a macro to calculate it automatically each time i add a month data column! :roll:

2) what is the right formula to average only the months of the year 2004 ? :roll:

Thank you very much .
Book1
BCDEFGHIJKLM
3
4
5nov.03dec.03jan.04feb.04mar.04apr.04mai.04jun.04Averagein2004Averagelast3months
63021384011262414#VALUE!??
786372326372710
8115383132273119
96341012295214
10189742881924
11
12
13
Sheet1
 
gaftalik said:
...Do you mean the % column should be empty ?

No. What follows treats the data as if it starts in column G. Keep G empty although it won't do any harm if G houses anything unrelated, except error values.
aaAverages gaftalik ext.xls
GHIJKLMNOPQRSTUVWX
20MonthAverageOf::2
215
2212
23OctoberNovemberDecemberJanuary
24UTTOTAL%UTTOTAL%UTTOTAL%UTTOTAL%
2598170.0783411928470.188755143170.09139832
264810580.2672813737740.2971892319420.22580658
272150710.3271891242540.2168671149600.32258157
283239710.3271894430740.2971894918670.36021570.5
29217249186
Sheet3


Formulas...

X20 houses 2, a last N parameter value.

X21:

=(X22-4*X20)+1

X22:

=MATCH(9.99999999999999E+307,G25:W25)-1

X25:

=AVERAGE(IF((MOD(COLUMN(INDEX($G25:$W25,$X$21):INDEX($G25:$W25,$X$22))-CELL("Col",INDEX($G25:$W25,$X$21))+1,4)=0),INDEX($G25:$W25,$X$21):INDEX($G25:$W25,$X$22)))

which must be confirmed with control+shift+enter instead of just enter.
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Champ,i am very grateful to you, so smoothly done!

Dear Gordon i am getting close to work out your solution but please check that when i put 2 months it shows 3 "y" where is my error?
question abt average.xls
ABCDEFGHIJKLMNOPQRST
42AverageLast2Months
43      y   y   y 
44OctoberNovemberDecemberJanuary
45UTTOTAL%UTTOTAL%UTTOTAL%UTTOTAL%
4698178%19284722%143178%98178%
4748105827%37377434%23194219%48105827%
4821507133%12425425%11496028%21507133%
4932397133%44307434%49186731%32397133%
50217249186217
Aladdin
 
Upvote 0
I suspect it is because the match part of the formula is looking out to far

)>=(MATCH(9,99999999999999E+307;G46:Z46)


the range should be set to one cell short of where your averages are housed. I suspect that range includes your average?

I take it you have now got the average part working?

Aladins solution is probably much better, but I wanted to see if I could come up with my own solution.
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,224,881
Messages
6,181,536
Members
453,054
Latest member
ezzat

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?

Disable AdBlock

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
Back
Top