#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 73
Default Using Average

First, thank you for helping. I hope this makes sense.

I'm trying to come up with a formula that will display the AVERAGE amount of
days a PO is open. The data that I have is:
PO Item Date Open Date Closed
1 1 01-25-09 02-15-09
1 2 01-30-09
1 3 02-05-09
2 1 02-14-09 02-25-09
3 1 02-25-09
4 1 03-02-09
4 2 03-02-09
For the items still open (date closed is blank) I want to average those only
by using the TODAY() function in the formula where the item is open, can this
be done?
The result I'm trying to find is:
PO Avg Days Open
1 168
2 0
3 152
4 149

Thank you in advance
Joe
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 915
Default Using Average

Joe Gieder wrote:
First, thank you for helping. I hope this makes sense.

I'm trying to come up with a formula that will display the AVERAGE amount of
days a PO is open. The data that I have is:
PO Item Date Open Date Closed
1 1 01-25-09 02-15-09
1 2 01-30-09
1 3 02-05-09
2 1 02-14-09 02-25-09
3 1 02-25-09
4 1 03-02-09
4 2 03-02-09
For the items still open (date closed is blank) I want to average those only
by using the TODAY() function in the formula where the item is open, can this
be done?
The result I'm trying to find is:
PO Avg Days Open
1 168
2 0
3 152
4 149

Thank you in advance
Joe


I can only reproduce your desired results by employing NETWORKDAYS.

Here is one approach:

Calculate NETWORKDAYS in a helper column*. I used

H2 =NETWORKDAYS(C2,IF(D2="",TODAY(),D2))

filled down through H8.

Next place 1, 2, 3, 4 in A11:A14 (your lookup values). Enter one of the
following formulas where it is convenient:

Formula A (no error handling,non-array)

=SUMPRODUCT(--($A$2:$A$8=A11),--($D$2:$D$8=""),$H$2:$H$8)/SUMPRODUCT(--($A$2:$A$8=A11),--($D$2:$D$8=""))

Formula B (no error handling, array-entered**)
=AVERAGE(IF(($A$2:$A$8=A11)*($D$2:$D$8=""),$H$2:$H $8))

Formula C (with error handling, non-array)

=IF(SUMPRODUCT(--($A$2:$A$8=A11),--($D$2:$D$8=""))=0,0,SUMPRODUCT(--($A$2:$A$8=A11),--($D$2:$D$8=""),$H$2:$H$8)/SUMPRODUCT(--($A$2:$A$8=A11),--($D$2:$D$8="")))

Formula D (with error handling, array-entered**)

=IF(ISERROR(AVERAGE(IF(($A$2:$A$8=A11)*($D$2:$D$8= ""),$H$2:$H$8))),0,AVERAGE(IF(($A$2:$A$8=A11)*($D$ 2:$D$8=""),$H$2:$H$8)))


* AFAIK NETWORKDAYS does not play nicely with arrays as input, so it is
necessary to precalculate it.

** Commit array formulas by pressing Ctrl+Shift+Enter; do not just press
Enter or Tab.
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
A formula to AVERAGE IF but only average a set number of values [email protected] Excel Worksheet Functions 2 January 31st 08 08:28 PM
Find monthly average but have average automatically configured kimbafred Excel Discussion (Misc queries) 2 August 8th 07 12:28 AM
Error Handling #N/A with AVERAGE Function - Average of values in Row Sam via OfficeKB.com Excel Worksheet Functions 13 July 31st 05 03:59 PM
Weighed Average of a weiged average when there are blanks krl - ExcelForums.com Excel Discussion (Misc queries) 1 July 6th 05 07:37 PM
how does one convert text to a formula "average(A:A)" to =average( phshirk Excel Worksheet Functions 4 April 14th 05 01:20 AM


All times are GMT +1. The time now is 11:10 AM.

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

About Us

"It's about Microsoft Excel"