View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bill Martin
 
Posts: n/a
Default shortening an equation, adding increments of a range..

Firstly, the way you're calculating your percent returns is a bit strange
-- maybe you need to do it that way, or maybe you can use a simpler
approach?

Specifically, for a two day return you're adding the gains of each day.
Typically what you want to do is to multiply them if two days of gains are
*compounded* (i.e. the full gains of day one are reinvested for day 2). If
you take that approach, then the two day return is (bi/bk). Ripple that
all the way through your IF statement and it will substantially reduce the
amount of "stuff" you're doing.

And if you accept the first approach, then you can get rid if a lot of IF
statements by using:

[ ] = IF(BI9="",COUNTA(...), (BI9/OFFSET(BI9,0,$AQ$2,1,1))-1)


Bill
------------------------
On Wed, 1 Mar 2006 01:47:05 -0800, nastech wrote:

hi, ok: tried to shorten the following, but don't see it. idea is range of
numbers from bi9 to bn9 (6 cells) to select 2 thru 5 of each (for a %change
equation).
to get a daily (incremental) total, I get accurate numbers by adding
separately.
Is there a shorter way? idea: (thanks)

2 day: (bi/bj)+(bj/bk)
3 day: (bi/bj)+(bj/bk)+(bk/bm) ..etc for 4 & 5 day

full example:
=IF(OR(BI9="",COUNTA(BJ9:BN9)=0),"",IF($AQ$2=2,(BI 9/BJ9%-100)+(BJ9/BK9%-100),IF($AQ$2=3,(BI9/BJ9%-100)+(BJ9/BK9%-100)+(BK9/BL9%-100),IF($AQ$2=4,(BI9/BJ9%-100)+(BJ9/BK9%-100)+(BK9/BL9%-100)+(BL9/BM9%-100),IF($AQ$2=5,(BI9/BJ9%-100)+(BJ9/BK9%-100)+(BK9/BL9%-100)+(BL9/BM9%-100)+(BM9/BN9%-100))))))