View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dallman Ross Dallman Ross is offline
external usenet poster
 
Posts: 390
Default SUMPRODUCT clue needed

Wow, but I believe I have figured it out. I put this
in, e.g., O39:

=SUMPRODUCT(OFFSET($P$1,MATCH($A39,$A:$A,0)-1,):$P39,OFFSET($F$1,MATCH($A39,$A:$A,0)-1,):$F39)/SUM(OFFSET($F$1,MATCH($A39,$A:$A,0)-1,):$F39)

If anyone has a better way, I'm all ears. But this is working.

------------------
In , Dallman Ross <dman@localhost.
spake thusly:

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