Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Dynamic Average Question

Hi All,

I am looking to write a formula that will average the total number of
hours worked for the last three months, but do not want to include any
months with zero values. In other words, the last three months could
actually be January, March and July (or they could be consecutive). I
was thinking of an average in conjunction with a counta formula, but
can't think of a way to have it stop and average when it hits 3 months.
Any Ideas? Let me know if I should explain further.

Example:

Jan. 150 hrs.
Feb. 0 hrs.
Mar. 110 hrs.
Apr. 0 hrs.
May 0 hrs.
June 160 hrs.

In this example it would skip Feb. Apr. May, but if July had data, it
would need to drop Jan. and use Mar., June and July.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Dynamic Average Question


Assuming your values are in column B:

Try:

=AVERAGE(IF(INDEX(B1:B100,SUMPRODUCT(LARGE(ROW(B1: B100)*(B1:B100<0),3))):B100,INDEX(B1:B100,SUMPROD UCT(LARGE(ROW(B1:B100)*(B1:B100<0),3))):B100))

Confirmed with CTRL+SHIFT+ENTER....not just ENTER (this is an array
formula).

Adjust ranges to accomodate all future entries (include header row).


If you have Excel 2003, then you can convert your current list
(assuming it's range is B1:B10 (including header row) to a List via
Data|List and then use this formula

=AVERAGE(IF(INDEX(B1:B10,SUMPRODUCT(LARGE(ROW(B1:B 10)*(B1:B10<0),3))):INDIRECT("B"&MATCH(9.9999999E +307,B1:B10)),INDEX(B1:B10,SUMPRODUCT(LARGE(ROW(B1 :B10)*(B1:B10<0),3))):INDIRECT("B"&MATCH(9.999999 9E+307,B1:B10))))

also confirmed with the CSE key combo.

With List feature, when you add more records, the formula will update
it's range automatically.


--
Vito
------------------------------------------------------------------------
Vito's Profile: http://www.excelforum.com/member.php...o&userid=29182
View this thread: http://www.excelforum.com/showthread...hreadid=558513

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 256
Default Dynamic Average Question

Here's another way...

=AVERAGE(IF(B2:B1000,IF(ROW(B2:B100)=LARGE(IF(B2 :B100,ROW(B2:B100)),3),
B2:B100)))

....confirmed with CONTROL+SHIFT+ENTER, not just ENTER. This assumes
that Column B contains your numbers, and does not include the text 'hrs'.

Hope this helps!

In article . com,
"Greg" wrote:

Hi All,

I am looking to write a formula that will average the total number of
hours worked for the last three months, but do not want to include any
months with zero values. In other words, the last three months could
actually be January, March and July (or they could be consecutive). I
was thinking of an average in conjunction with a counta formula, but
can't think of a way to have it stop and average when it hits 3 months.
Any Ideas? Let me know if I should explain further.

Example:

Jan. 150 hrs.
Feb. 0 hrs.
Mar. 110 hrs.
Apr. 0 hrs.
May 0 hrs.
June 160 hrs.

In this example it would skip Feb. Apr. May, but if July had data, it
would need to drop Jan. and use Mar., June and July.

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
Modified Average Function PA Excel Worksheet Functions 3 May 15th 06 12:20 PM
average function in Excel 2002 Sherry New Users to Excel 13 May 8th 05 01:49 PM
Average If Question Renee Excel Discussion (Misc queries) 1 March 31st 05 11:01 PM
Average If Question Renee Excel Discussion (Misc queries) 6 March 29th 05 09:39 PM
a question regarding dynamic ranges and charts Wazooli Charts and Charting in Excel 2 March 28th 05 11:25 PM


All times are GMT +1. The time now is 09:12 AM.

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"