+ Reply to Thread
Results 1 to 3 of 3

array formula with a dynamic range.

  1. #1
    Dave
    Guest

    array formula with a dynamic range.

    Hello,

    I have this array formula:
    =SUM(IF(Trades!$J$2:Trades!$J$170>=$M$23,IF(Trades!$J$2:Trades!$J$170<=$N$23,Trades!$L$2:Trades!$L$170,0),0))

    I need the Trades!$J$2:Trades!$J$170, Trades!$J$2:Trades!$J$170 and
    Trades!$L$2:Trades!$L$170 to be dynamic in lenght.

    This is a stock trading sheet that I use to record my buys and sells of
    stock. As I buy and sell more stocks I would like the formula to adjust to
    include the new stocks. This formula is calculating the profit/loss for each
    week of each month. It works great right now except I have to go and change
    the lenght of the range 52 times (each week of the year) every time I sell
    more stocks.

    Is there an easy way to adjust the lenghts in this array so that I could
    change the lenght easier? is there a way to use a variable for the lenght of
    the array formula? Or an easier way to change the lenght for each week of the
    year?


  2. #2
    Biff
    Guest

    Re: array formula with a dynamic range.

    See this:

    http://contextures.com/xlNames01.html#Dynamic

    In the meantime, try this: (normally entered, not an array)

    =SUMIF(Trades!J2:J170,">="&M23,Trades!L2:L170)-SUMIF(Trades!J2:J170,">"&N23,Trades!L2:L170)

    Biff

    "Dave" <Dave@discussions.microsoft.com> wrote in message
    news:8968D79F-BAE3-4963-804D-CBAD01C6C654@microsoft.com...
    > Hello,
    >
    > I have this array formula:
    > =SUM(IF(Trades!$J$2:Trades!$J$170>=$M$23,IF(Trades!$J$2:Trades!$J$170<=$N$23,Trades!$L$2:Trades!$L$170,0),0))
    >
    > I need the Trades!$J$2:Trades!$J$170, Trades!$J$2:Trades!$J$170 and
    > Trades!$L$2:Trades!$L$170 to be dynamic in lenght.
    >
    > This is a stock trading sheet that I use to record my buys and sells of
    > stock. As I buy and sell more stocks I would like the formula to adjust to
    > include the new stocks. This formula is calculating the profit/loss for
    > each
    > week of each month. It works great right now except I have to go and
    > change
    > the lenght of the range 52 times (each week of the year) every time I sell
    > more stocks.
    >
    > Is there an easy way to adjust the lenghts in this array so that I could
    > change the lenght easier? is there a way to use a variable for the lenght
    > of
    > the array formula? Or an easier way to change the lenght for each week of
    > the
    > year?
    >




  3. #3
    Arvi Laanemets
    Guest

    Re: array formula with a dynamic range.

    Hi


    Assuming your table on Trades sheet doesn't have any gaps, it has row 1 as
    header row, and column A is always filled when there are some data in row:
    Define named ranges like
    Name1=OFFSET(Trades!$J$1,1,,COUNTA(Trades!$A:$A)-1,1)
    Name2=OFFSET(Trades!$L$1,1,,COUNTA(Trades!$A:$A)-1,1)

    My advice is to use SUMPRODUCT instead of array formula
    =SUMPRODUCT(--(Name1>=$M$23,--(Name1>=$N$23,Name2)

    Arvi Laanemets


    "Dave" <Dave@discussions.microsoft.com> wrote in message
    news:8968D79F-BAE3-4963-804D-CBAD01C6C654@microsoft.com...
    > Hello,
    >
    > I have this array formula:
    >

    =SUM(IF(Trades!$J$2:Trades!$J$170>=$M$23,IF(Trades!$J$2:Trades!$J$170<=$N$23
    ,Trades!$L$2:Trades!$L$170,0),0))
    >
    > I need the Trades!$J$2:Trades!$J$170, Trades!$J$2:Trades!$J$170 and
    > Trades!$L$2:Trades!$L$170 to be dynamic in lenght.
    >
    > This is a stock trading sheet that I use to record my buys and sells of
    > stock. As I buy and sell more stocks I would like the formula to adjust to
    > include the new stocks. This formula is calculating the profit/loss for

    each
    > week of each month. It works great right now except I have to go and

    change
    > the lenght of the range 52 times (each week of the year) every time I sell
    > more stocks.
    >
    > Is there an easy way to adjust the lenghts in this array so that I could
    > change the lenght easier? is there a way to use a variable for the lenght

    of
    > the array formula? Or an easier way to change the lenght for each week of

    the
    > year?
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1