Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Whats wrong with this array formula


I have a worksheet with 5 city names in column A and dollar amounts in
column I.
I need to calculate the average amount for each city.
I use the array formula {=AVERAGE(I2:I9176*(A2:A9176="philadelphia"))} and
get 621.45. I also did this using an average value calculation in a Pivot
Table and got the result 1987.54 for Philadelphia. The other 4 cities had
similar discrepancies.

Is there something wrong with the array formula (No I did not type the
brackets) or am I interpreting the two results incorrectly?
Thanks,
Carl
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Whats wrong with this array formula

{=AVERAGE(I2:I9176*(A2:A9176="philadelphia"))}
Is there something wrong with the array formula


Yes

Where A2:A9176 does not equal philadelphia, the result of the multiplication
is 0. So, your formula is including any of those 0s in the average.

Try this array formula** :

=AVERAGE(IF(A2:A9176="philadelphia",I2:I9176))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Carl_B" wrote in message
...

I have a worksheet with 5 city names in column A and dollar amounts in
column I.
I need to calculate the average amount for each city.
I use the array formula {=AVERAGE(I2:I9176*(A2:A9176="philadelphia"))}
and
get 621.45. I also did this using an average value calculation in a Pivot
Table and got the result 1987.54 for Philadelphia. The other 4 cities had
similar discrepancies.

Is there something wrong with the array formula (No I did not type the
brackets) or am I interpreting the two results incorrectly?
Thanks,
Carl



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Whats wrong with this array formula

Try it this way:

=AVERAGE(IF(A2:A9176="philadelphia",I2:I9176))

Still array-entered using Ctrl-Shift-Enter.

Hope this helps.

Pete

On Feb 16, 6:55*pm, Carl_B wrote:
I have a worksheet with 5 city names in column A and dollar amounts in
column I.
I need to calculate the average amount for each city.
I use the array formula *{=AVERAGE(I2:I9176*(A2:A9176="philadelphia"))} and
get 621.45. *I also did this using an average value calculation in a Pivot
Table and got the result 1987.54 for Philadelphia. *The other 4 cities had
similar discrepancies.

Is there something wrong with the array formula (No I did not type the
brackets) or am I interpreting the two results incorrectly?
Thanks,
Carl


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Whats wrong with this array formula - I figured it out

Using
{=AVERAGE(IF((A2:A9176="philadelphia"),(I2:I9176)) )}
produces the correct result

"Carl_B" wrote:


I have a worksheet with 5 city names in column A and dollar amounts in
column I.
I need to calculate the average amount for each city.
I use the array formula {=AVERAGE(I2:I9176*(A2:A9176="philadelphia"))} and
get 621.45. I also did this using an average value calculation in a Pivot
Table and got the result 1987.54 for Philadelphia. The other 4 cities had
similar discrepancies.

Is there something wrong with the array formula (No I did not type the
brackets) or am I interpreting the two results incorrectly?
Thanks,
Carl

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Whats wrong with this array formula - I figured it out

Using
{=AVERAGE(IF((A2:A9176="philadelphia"),(I2:I9176) ))}
produces the correct result


OK, now get rid of the unnecessary parentheses.

Array entered:

=AVERAGE(IF(A2:A9176="philadelphia",I2:I9176))

--
Biff
Microsoft Excel MVP


"Carl_B" wrote in message
...
Using
{=AVERAGE(IF((A2:A9176="philadelphia"),(I2:I9176)) )}
produces the correct result

"Carl_B" wrote:


I have a worksheet with 5 city names in column A and dollar amounts in
column I.
I need to calculate the average amount for each city.
I use the array formula {=AVERAGE(I2:I9176*(A2:A9176="philadelphia"))}
and
get 621.45. I also did this using an average value calculation in a
Pivot
Table and got the result 1987.54 for Philadelphia. The other 4 cities
had
similar discrepancies.

Is there something wrong with the array formula (No I did not type the
brackets) or am I interpreting the two results incorrectly?
Thanks,
Carl





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 524
Default Whats wrong with this array formula

Tue, 16 Feb 2010 10:55:01 -0800 from Carl_B
:

I have a worksheet with 5 city names in column A and dollar amounts in
column I.
I need to calculate the average amount for each city.
I use the array formula {=AVERAGE(I2:I9176*(A2:A9176="philadelphia"))} and
get 621.45.
Is there something wrong with the array formula


You're gonna kick yourself. :-)

Consider a row, say row 88, where A88 doesn't equal Philadelphia.
What value is contributed to the average by that row? Right, since
the value of a false condition is 0, that row contributes a zero,
which drags the average down.

Replace the AVERAGE with COUNT and it will be more obvious.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com
Shikata ga nai...
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Whats wrong with this array formula - I figured it out

:-) I have an issue with over doing the parentheses.
And I realize that more is not necessarily better!

Thank you, and thanks to Pete and Stan as well.

"T. Valko" wrote:

Using
{=AVERAGE(IF((A2:A9176="philadelphia"),(I2:I9176) ))}
produces the correct result


OK, now get rid of the unnecessary parentheses.

Array entered:

=AVERAGE(IF(A2:A9176="philadelphia",I2:I9176))

--
Biff
Microsoft Excel MVP


"Carl_B" wrote in message
...
Using
{=AVERAGE(IF((A2:A9176="philadelphia"),(I2:I9176)) )}
produces the correct result

"Carl_B" wrote:


I have a worksheet with 5 city names in column A and dollar amounts in
column I.
I need to calculate the average amount for each city.
I use the array formula {=AVERAGE(I2:I9176*(A2:A9176="philadelphia"))}
and
get 621.45. I also did this using an average value calculation in a
Pivot
Table and got the result 1987.54 for Philadelphia. The other 4 cities
had
similar discrepancies.

Is there something wrong with the array formula (No I did not type the
brackets) or am I interpreting the two results incorrectly?
Thanks,
Carl



.

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Whats wrong with this array formula - I figured it out

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Carl_B" wrote in message
...
:-) I have an issue with over doing the parentheses.
And I realize that more is not necessarily better!

Thank you, and thanks to Pete and Stan as well.

"T. Valko" wrote:

Using
{=AVERAGE(IF((A2:A9176="philadelphia"),(I2:I9176) ))}
produces the correct result


OK, now get rid of the unnecessary parentheses.

Array entered:

=AVERAGE(IF(A2:A9176="philadelphia",I2:I9176))

--
Biff
Microsoft Excel MVP


"Carl_B" wrote in message
...
Using
{=AVERAGE(IF((A2:A9176="philadelphia"),(I2:I9176)) )}
produces the correct result

"Carl_B" wrote:


I have a worksheet with 5 city names in column A and dollar amounts in
column I.
I need to calculate the average amount for each city.
I use the array formula
{=AVERAGE(I2:I9176*(A2:A9176="philadelphia"))}
and
get 621.45. I also did this using an average value calculation in a
Pivot
Table and got the result 1987.54 for Philadelphia. The other 4 cities
had
similar discrepancies.

Is there something wrong with the array formula (No I did not type the
brackets) or am I interpreting the two results incorrectly?
Thanks,
Carl



.



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
Whats wrong with this formula oldjay Excel Discussion (Misc queries) 7 February 8th 10 05:44 PM
Whats wrong with this OR formula? Mark Excel Worksheet Functions 4 October 23rd 06 07:16 PM
whats wrong with the formula? Gary Excel Worksheet Functions 2 August 3rd 06 11:33 AM
Whats wrong with this? LucasBuck Excel Discussion (Misc queries) 3 January 12th 06 08:15 PM
Whats Wrong with this?? drvortex Excel Worksheet Functions 1 October 30th 04 06:48 PM


All times are GMT +1. The time now is 04:22 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"