#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
anand
 
Posts: n/a
Default sumproduct?

Can anyone provide a way to perform the following function. I've been told
there is a way to do with "sumproduct" which I use.

Column A and B each have values in 100+ rows. Each cell in the column has
one of several different #'s in them.

If there is a "1" in the cell of a given row in in column A and a "2" in the
cell of the same row in column B, what is the average of values cells of the
same row in column C. i.e. i.e. give the average of values in column C
restricting to rows where there is a "1" in column A and a "2" in column B.

Can this function be done in Excel? Or am i stuck with SPSS or some such.

anand
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
tjtjjtjt
 
Posts: n/a
Default sumproduct?

This is not a SUMPRODUCT solution, but it should work:
=AVERAGE(IF(A1:A200=1,IF(B1:B200=2,C1:C200)))
This is an array formula. You need to press Ctl+Shift+Enter to make it work
(not jsut Enter).
If you entered it correctly, you will see
{=AVERAGE(IF(A1:A200=1,IF(B1:B200=2,C1:C200)))} in the formula bar (you don't
type the {} yourself).
Adjust the range size to your needs.


--
tj


"anand" wrote:

Can anyone provide a way to perform the following function. I've been told
there is a way to do with "sumproduct" which I use.

Column A and B each have values in 100+ rows. Each cell in the column has
one of several different #'s in them.

If there is a "1" in the cell of a given row in in column A and a "2" in the
cell of the same row in column B, what is the average of values cells of the
same row in column C. i.e. i.e. give the average of values in column C
restricting to rows where there is a "1" in column A and a "2" in column B.

Can this function be done in Excel? Or am i stuck with SPSS or some such.

anand

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier
 
Posts: n/a
Default sumproduct?

Hi

You have an array solution from tj which gives you your required result.
You specifically asked about doing it with Sumproduct, (which is not an
array solution), so for completeness here is a Sumproduct answer

=SUMPRODUCT(--(A1:A20=1),--(B1:B20=2),C1:C20)/SUMPRODUCT(--(A1:A20=1),--(B1:B20=2))
Change ranges to suit

Regards

Roger Govier


anand wrote:
Can anyone provide a way to perform the following function. I've been told
there is a way to do with "sumproduct" which I use.

Column A and B each have values in 100+ rows. Each cell in the column has
one of several different #'s in them.

If there is a "1" in the cell of a given row in in column A and a "2" in the
cell of the same row in column B, what is the average of values cells of the
same row in column C. i.e. i.e. give the average of values in column C
restricting to rows where there is a "1" in column A and a "2" in column B.

Can this function be done in Excel? Or am i stuck with SPSS or some such.

anand

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
Sumproduct Peter B Excel Worksheet Functions 1 March 7th 05 01:59 PM
sumproduct causing memory errors? dave Excel Worksheet Functions 1 March 3rd 05 09:31 AM
Can I reference =, <, or > sign in SUMPRODUCT BobT Excel Discussion (Misc queries) 7 February 16th 05 01:58 PM
Sumproduct function not working Scott Summerlin Excel Worksheet Functions 12 December 4th 04 05:15 AM
adding two sumproduct formulas together ski2004_2005 Excel Worksheet Functions 1 November 12th 04 09:08 PM


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