+ Reply to Thread
Results 1 to 9 of 9

Using the right formula to MATCH/INDEX/VLOOKUP cells that follow a specific condition

  1. #1
    Registered User
    Join Date
    11-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    76

    Using the right formula to MATCH/INDEX/VLOOKUP cells that follow a specific condition

    Please see the attachment.

    On sheet Data I have a list of soccer matches (A:B) played on various dates (C:C) with results (D:E) and statistics (F:G) plus some counter columns (H:I) highlighting the most recently completed matches.

    On sheet Preview I would like to separate this data as shown on the attachment, into home and away team previews.
    In this example, I would like to compare Nines vs Kangas,
    By writing "Nines" into cell A2 I would like to put the correct formulas into A4:G9 to complete the data as shown in the attachment. This will show the most recently played match (defined by when there is a score inserted in Data!D:E) involving Nines on the top line, and then the rest of the results below in chronological order, regardless of whether they play at home or away.

    In order to achieve this, do I need to have a series of looks ups? Do I need to have a further counting column on the Data page that counts either??


    Thanks,
    Marco
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,208

    Re: Using the right formula to MATCH/INDEX/VLOOKUP cells that follow a specific condition

    Do you want ALL games or only the last 6 (or "n" games)?

  3. #3
    Registered User
    Join Date
    11-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: Using the right formula to MATCH/INDEX/VLOOKUP cells that follow a specific condition

    "n" games would be best

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,208

    Re: Using the right formula to MATCH/INDEX/VLOOKUP cells that follow a specific condition

    Using "Helper" column ...

    in column J

    =IF(OR(A2=Preview!$A$13,B2=Preview!$A$13),"A",IF(OR(A2=Preview!$A$2,B2=Preview!$A$2),"H",""))

    Copy down

    "Home" team (NINES) set as "H", away team ("Kangas") set as "A"

    in "Preview"

    in A4

    =IFERROR(INDEX(Data!A$2:A$300,LARGE(IF((Data!$J$2:$J$300="H")*(Data!$D$2:$D$300<>""),ROW(Data!$A$2:$A$300)-ROW($A$2)+1,""),ROWS($A$2:A2))),"")

    enter with Ctrl+Shift+Enter

    Copy across and down

    in A15

    =IFERROR(INDEX(Data!A$2:A$300,LARGE(IF((Data!$J$2:$J$300="A")*(Data!$D$2:$D$300<>""),ROW(Data!$A$2:$A$300)-ROW($A$2)+1,""),ROWS($A$2:A2))),"")

    enter with Ctrl+Shift+Enter

    Copy across and down


    Format column C as "dd-mmm"

    If you want "n" games just copy down until you get blanks (all games) or you have reached your "n"

    NOTE: I use the Home/Away cells in "Preview" so if you change their location the formula will need amending in "Data" column J
    Attached Files Attached Files
    Last edited by JohnTopley; 12-29-2016 at 07:31 AM.

  5. #5
    Registered User
    Join Date
    11-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: Using the right formula to MATCH/INDEX/VLOOKUP cells that follow a specific condition

    Outstanding, thank you very much JohnTopley

  6. #6
    Registered User
    Join Date
    11-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: Using the right formula to MATCH/INDEX/VLOOKUP cells that follow a specific condition

    Just one question though.

    In the latest attachment I have extended the data to 244 rows, this time with the reverse fixture of Kangas v Nines as the next match.
    On the Preview page, the previous match between them only appears on Kangas AWAY data, and it does not appear as the Nines' previous match.

    Is there any way around this?
    Attached Files Attached Files
    Last edited by milkychips; 12-29-2016 at 08:27 AM.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,208

    Re: Using the right formula to MATCH/INDEX/VLOOKUP cells that follow a specific condition

    Used 2 helper columns;

    in J

    =IF(OR($A2=Preview!$A$2,$B2=Preview!$A$2),"H","")

    in K

    =IF(OR($A2=Preview!$A$17,$B2=Preview!$A$17),"A","")

    in Preview

    in A19

    =IFERROR(INDEX(Data!A$2:A$300,LARGE(IF((Data!$K$2:$K$300="A")*(Data!$D$2:$D$300<>""),ROW(Data!$A$2:$A$300)-ROW($A$2)+1,""),ROWS($A$2:A2))),"")

    Enter as before

    I would put the AWAY table alongside the home (say column J)
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: Using the right formula to MATCH/INDEX/VLOOKUP cells that follow a specific condition

    Splendid.
    Thanks

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,914

    Re: Using the right formula to MATCH/INDEX/VLOOKUP cells that follow a specific condition

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. INDEX MATCH or VLOOKUP formula based on a condition
    By apple_tree in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 09-16-2016, 02:31 AM
  2. Replies: 8
    Last Post: 03-17-2016, 08:14 PM
  3. [SOLVED] Vlookup (IFS) 3 Condition Model Using Index /Match
    By Winship in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-28-2014, 07:06 PM
  4. Replies: 4
    Last Post: 01-13-2014, 04:16 AM
  5. Replies: 2
    Last Post: 09-25-2013, 07:18 PM
  6. looking up specific cells utilizing named ranges, index/match in VBA?
    By hlep in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2012, 09:44 AM
  7. Replies: 0
    Last Post: 12-03-2011, 12:04 PM

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