+ Reply to Thread
Results 1 to 5 of 5

Resolved >>> Number of consecutive first values

  1. #1
    Registered User
    Join Date
    10-25-2007
    Posts
    35

    Cool Resolved >>> Number of consecutive first values

    Hi,

    I'm writing a little excel file to help me with my betting. Basically I want to calculate each team's home winning/drawing/losing streak.

    Here is a sample of the table (I've simplified it a bit and added fictional results):

    (See Attached)

    So, I want a formula that can tell me a given team's (e.g. Arsenal's) latest result, and how many previous consecutive results of that kind there have been. For example, for Arsenal, the result would be something like "W2" (i.e. Won the last two games).

    At the moment, the best I can do is to get the TOTAL NUMBER of a given team's latest result using this formula:

    =LOOKUP("ARS",B:B,C:C)&SUMPRODUCT(--(B1:B13="ARS")*(C1:C13=LOOKUP("ARS",B:B,C:C)))

    (Which also returns "W2").

    I'm sooooooo close, can someone please help!!

    As an added bonus, could anyone help me in writing a formula that would express a given team's last 5 (or last n) results in the format "WWLDW" or "LLDDW"?
    Attached Images Attached Images
    Last edited by owainl; 10-25-2007 at 06:47 AM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,695
    Hello owainl,

    I presume you want to look at both home and away matches together, your formula is only looking at home games?

    Starting with the second part first.....

    I think you'd have difficulty doing this with regular formulas because you need a formula that will concatenate a range, I think. You could try downloading morefunc add-in and using MCONCAT function like this

    =LEFT(MCONCAT(IF(B2:B13="ars",C2:C13,"")&IF(E2:E13="ars",F2:F13,"")),5)

    confirmed with CTRL+SHIFT+ENTER

    For Arsenal this will give WLWD because there are only 4 games shown

    For the first part I presume the result for Tottenham would be L1 and for Man Utd W4?

  3. #3
    Registered User
    Join Date
    10-25-2007
    Posts
    35
    OK, I'm at work right now so I'll try Morefunc when I get home - many thanks nonetheless. I would actually like a breakdown of home and away results (as well as the overall value that you've kindly provided). I can see how this would be done with the MCONCAT function but sticking to my primary concern (i.e. winning/drawing/losing streaks), how would I do this?

    And yes, you're correct in presuming the results for Tottenham and Man U.

    Thanks for your help - much appreciated.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,695
    OK,

    I'm sure you can do the first part with "native" excel formulas but trying to take into account all possibilities, team has no home games, or no away games etc. will make it a rather involved formula.

    If morefunc works for you I'd suggest this sort of setup to answer both your queries. In H2 use this formula to give all results for "ARS"

    =MCONCAT(IF(B2:B13="ars",C2:C13,"")&IF(E2:E13 ="ars",F2:F13,""))

    confirmed with CTRL+SHIFT+ENTER

    If you only want to show the last 5 results then in H3

    =LEFT(H2,5)

    Now to get the latest "run" of results, using INTVECTOR function also from morefunc, in H4

    =LEFT(H2)&MATCH(TRUE,LEFT(H2)<>MID(H2&"x",INTVECTOR(LEN(H2),1)+1,1),0)

    also confirmed with CTRL+SHIFT+ENTER

    If you don't want to see H2 custom format that cell as ;;;

    Note: I think you have an error in your data. You show one result as Tottenham 3 Fulham 0. As a long-standing follower of the "mighty" Spurs I can assure you that such a result, clean sheet, winning by 3, is impossible.

  5. #5
    Registered User
    Join Date
    10-25-2007
    Posts
    35
    All I can say is "Bravo!" Does exactly what I wanted - I'll be sure to check out the workings of the formula when I'm sober.

    ANd of course, goodbye Mr Jol! 2-1 Getafe, well I never...

+ 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