+ Reply to Thread
Results 1 to 5 of 5

Sumproduct formula to count the latest run of 1's problem

  1. #1
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Sumproduct formula to count the latest run of 1's problem

    Hello people.. I have a Sumproduct formula where I'm trying to have the arrays start from A10. It counts the last consecutive run of 1's. If the arrays start at A1, the formula works as it should. If it starts at A10, it returns -9. I can't figure out where to put the adjustment. Normally it would be ROW()-9, but not this time it seems.
    I've posted both versions
    Any ideas please
    Thanks
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by Philb1; 02-14-2012 at 02:47 AM.

  2. #2
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Sumproduct formula to count the latest run of 1's problem

    Hi Phil,

    It would be easier to understand with a Dummy Worksheet.

    REgards
    e4excel

  3. #3
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Sumproduct formula to count the latest run of 1's problem

    I think you want:

    =SUMPRODUCT(MAX((ROW(A$10:A$100)-9)*(A$10:A$100=1)))-SUMPRODUCT(MAX((ROW(A$10:INDEX(A$10:A$100,SUMPRODUCT(MAX((ROW(A$10:A$100)-9)*(A$10:A$100=1)))))-9)*(A$10:INDEX(A$10:A$100,SUMPRODUCT(MAX((ROW(A$10:A$100)-9)*(A$10:A$100=1))))="")))
    Good luck.

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Sumproduct formula to count the latest run of 1's problem

    Or perhaps easier to adjust yourself in future:

    =SUMPRODUCT(MAX((ROW(A$10:A$100)-ROW(A$10)+1)*(A$10:A$100=1)))-SUMPRODUCT(MAX((ROW(A$10:INDEX(A$10:A$100,SUMPRODUCT(MAX((ROW(A$10:A$100)-ROW(A$10)+1)*(A$10:A$100=1)))))-ROW(A$10)+1)*(A$10:INDEX(A$10:A$100,SUMPRODUCT(MAX((ROW(A$10:A$100)-ROW(A$10)+1)*(A$10:A$100=1))))="")))

  5. #5
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Sumproduct formula to count the latest run of 1's problem

    Thank you Rory..
    I had all the -9's in the right place, except for the third one when I was trying. I was on the right track, but not quite.
    Thanks again
    Phil

+ 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