+ Reply to Thread
Results 1 to 5 of 5

sum until value greater

  1. #1
    Registered User
    Join Date
    05-18-2007
    Posts
    9

    sum until value greater

    I'm looking to do a sumproduct on two arrays of values arranged from smallest to largest (one of shares, the other of the corresponding share prices), but i want the sumproduct to stop when it finds a share price in the array that's bigger than a given value. ie sumproduct(a1:a5,b1:b5) where if, say, b4>d4 (d4 is my given value), then it outputs sumproduct(a1:a3,b1:b3). or if b1>d4, then it outputs nothing.

    thanks a lot

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon trentsim

    Does this help :

    =SUMPRODUCT(--(B1:B5<=D4),(A1:A5))

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    05-18-2007
    Posts
    9
    thanks for the reply -- it seems like what you suggested just tells you the number of cells in the b1:b5 array that are less than d4, rather than giving me the sumproduct of those cells with their corresponding a1:a5 cells.

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi trentsim

    Oh!
    Well, if that's the case try something like this :
    =SUMPRODUCT(--(B1:B5<=D4),(A1:A5)*(B1:B5))

    HTH

    DominicB

  5. #5
    Registered User
    Join Date
    05-18-2007
    Posts
    9
    worked like a charm, thank'ee kindly

    trentsim

+ 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