View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
David Benson David Benson is offline
external usenet poster
 
Posts: 5
Default SUMPRODUCT clue needed

Dallman,

One approach would be to use array formulas. If the full range of data
extends from Row 1 to Row 200, the formula in Coll O38 would be:

=SUMPRODUCT(if(O38=$A$1:$A$200,$P$1:$P$200,0),if(O 38=$A$1:$A$200,$F$1:$F$200,0))/SUM(if(O38=$A$1:$A$200,$F$1:$F$200,0))

After you type in this formula, press <CTRL<SHIFT<ENTER -- all three keys
at the same time. You will see curly brackets ("{" and "}") appear around
the expression, indicating it is an array formula.

A note about array formulas: If you copy the formula to other cells, be
sure and do a Copy Paste Special Formulas, not just a regular Copy
Paste (you can also Paste Special Formats if you need to replicate
formats). If you do a regular Copy Paste, you may be designating the
entire range covered by the Paste as an array, which means you will then be
unable to modify the formula in individual cells.

Good luck!

-- David



"Dallman Ross" <dman@localhost. wrote in message
...
Assume a table of data sort of like this:


A ... G ... O P

1 Stock Cost Running Avg Nominal Rate
Return by Issue of Return

2 Foo 3555.20 6.77% 6.77%
3 Foo 3225.29 2.23% -2.30%
4 Foo 2708.08 2.39% 2.71%
5 Foo 3838.93 2.65% 7.62%
--------------------------------------------------
6 Bar 12984.44 11.77% 11.77%
7 Bar 11543.87 14.67% 17.73%
8 Bar 11543.87 15.56% 17.38%


(The data in "O" and "P" are actual samples.) I'm trying
to devise a formula to do the work automatically. When
a new stock shows up in Column "A," the running average
should reset -- as it does here in Row 6.

Right now, Column "O" has a formula that looks like this
for rows 2 through 38, with this sample being from "O38":

=SUMPRODUCT($P$2:$P38,$F$2:$F38)/SUM($F$2:$F38)

And for rows 39 onward until the next stock appears, it
looks like this:

=SUMPRODUCT($P$39:$P39,$F$39:$F39)/SUM($F$39:$F39)

I had to adjust the start of the range manually when I
added data to the table. I don't want to have to do that
anymore. I want the formula to keep track of when the
value in Column "A" changes. I'm stuck . . .

Thanks for any help!

Dallman Ross