+ Reply to Thread
Results 1 to 8 of 8

Counting consecutive events (not ordered)

Hybrid View

  1. #1
    Registered User
    Join Date
    01-05-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Counting consecutive events (not ordered)

    Hi

    I am trying to count the number of times a team has scored consecutive occasions, but struggling to generate a formula as the data is not ordered. On the spreadsheet attached, Cell H28 would be looking for the number of consecutive times "Manchester United" appeared in the cells above B28 in instances where D28 is =1.

    Would be extremely grateful if anyone had any suggestions?

    Thanks.

    PL results.xlsx

  2. #2
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256

    Re: Counting consecutive events (not ordered)

    Is this right?
    //Ola


    Cell H382: =SUM(($B$2:$B382=$B382)*($A$2:$A382>MAX(IF(($B$2:$B382=$B382)*($D$2:$D382=0);$A$2:$A382))))
    --> 5
    Confirm the typed formula with Ctrl+Shift+Enter
    Mark the problem as Solved under the Yellow bar up Top right, under Thread Tools, when you received a solution.
    It saves time, to skip already solved threads.

  3. #3
    Registered User
    Join Date
    01-05-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting consecutive events (not ordered)

    Hi Ola

    Thanks for your reply. Unfortunetly there is an error in the code, it appears to flag the following as the source of the error.

    =SUM(($B$2:$B382=$B382)*($A$2:$A382>MAX(IF(($B$2:$B382=$B382)*($D$2:$D382=0);$A$2:$A382))))

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Counting consecutive events (not ordered)

    try and replace ; with , it's probably a regional thing
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Counting consecutive events (not ordered)

    change the semicolon to a comma and try that
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  6. #6
    Registered User
    Join Date
    01-05-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting consecutive events (not ordered)

    Awesome, thanks very much.

  7. #7
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256

    Re: Counting consecutive events (not ordered)

    Happy to hear.
    Please mark the problem as solved (see footnote)
    //Ola

  8. #8
    Registered User
    Join Date
    01-05-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting consecutive events (not ordered)

    Hi Ola.

    The formula works perfectly for the first column, but I’m having trouble understanding the logic and thus extending to the other three. Would you be able to help?

    Column I is doing the same as column H but it is looking for the consecutive games the home team (when the team in column B appears in column E) has scored in away from home (column G).

    Column J is looking at how many games the home team (column B) has conceded in at home (column G for the same row entry as column B).

    Column K is looking at how many games the home team (when team in column B appears in column E) has conceded when they are away from home (Column D for the same row).

    If you be amazing if you were able to give some further help on this.

    Thanks,
    Tim.

+ 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