+ Reply to Thread
Results 1 to 11 of 11

deleting rows depending on values on another sheet

  1. #1
    Registered User
    Join Date
    08-24-2005
    Location
    Ireland
    MS-Off Ver
    O365
    Posts
    75

    deleting rows depending on values on another sheet

    hello all.

    i am using excel database (see attachemet) to list player games vs one another. In sheet 1 listed in column A and C are players 1 and 2 games (eg A1 vs C1).
    On sheet 2 a certain group are allocated points on previous match history. I am looking to write code to delete players games from sheet 1 (delete entire row) depending on points they have on sheet 2. Firstly I want to find the golden points tally that will remove them from games in sheet 1. The golden points tally will calculated by the player that is top of the last quarter of teams (which would be Lucas on 8 points) and i want to add 3 on to this which would bring golden points to 11.. and basically delete anyone, that has 11 points or less in the group, from the games on sheet1.
    The results of the script would be that games involving Loren, Margarett, Lynn, Luciano, Lucas, Erwin, Derek, and Davina should all be deleted from sheet 1 because they have only 11 or less points.
    Anyone assist with this? Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: deleting rows depending on values on another sheet

    Will there always be 20 players in column A on sheet 2 or can this number vary?

  3. #3
    Registered User
    Join Date
    08-24-2005
    Location
    Ireland
    MS-Off Ver
    O365
    Posts
    75

    Re: deleting rows depending on values on another sheet

    Ok. that way of removing matches is not going to work. i need to do it another way. On the attached workbook (player games2) there is a list of matches in sheet1. In sheet 2 is the table.
    I am looking for a way to cycle through all the games in sheet1 and remove the games if the players are side by side in the table.
    for eg.. Abraham Vs Zack match should be removed because they are 6th and 7th.
    And Alfonso Vs Jolanda match should be removed because they are 4th and 3rd. any ideas?
    Player games2.xlsx

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: deleting rows depending on values on another sheet

    Hi ghynes,

    Assuming that Ali Vs Jonathan should also be deleted as they are 8th and 9th, the following will do the trick:

    Please Login or Register  to view this content.
    Not too sure what will happen when the player list expands as the MATCH function works off the first match found

    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Registered User
    Join Date
    08-24-2005
    Location
    Ireland
    MS-Off Ver
    O365
    Posts
    75

    Re: deleting rows depending on values on another sheet

    Super stuff Robert. Trying to make a few additions to it. I have added ad-hoc games to the sheet 1 with different players names that are not in the league table and these get an #N/A beside them too and end up getting deleted... i presume its because they are not found on the league table?

  6. #6
    Registered User
    Join Date
    08-24-2005
    Location
    Ireland
    MS-Off Ver
    O365
    Posts
    75

    Re: deleting rows depending on values on another sheet

    I have added the line of code thats bolded below and it seems to do the trick..

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: deleting rows depending on values on another sheet

    i presume its because they are not found on the league table
    Yes, that's why they're being deleted. To be consistent with the formula the code puts in, I'd have it like this:

    Please Login or Register  to view this content.
    But that's being really picky!!

    If your issue is solved you should mark the thread as so.

    Kind regards,

    Robert

  8. #8
    Registered User
    Join Date
    08-24-2005
    Location
    Ireland
    MS-Off Ver
    O365
    Posts
    75

    Re: deleting rows depending on values on another sheet

    Top stuff. Thanks again.

  9. #9
    Registered User
    Join Date
    08-24-2005
    Location
    Ireland
    MS-Off Ver
    O365
    Posts
    75

    Re: deleting rows depending on values on another sheet

    Hey Robert,

    Trying to run the code of every worksheet in the workbook.. is it possible to use ws in the code like below..? is it not working for me.
    I have everything set up correctly for the ws but dont know how to use it in a formula.

    Original:
    Please Login or Register  to view this content.
    Edited with ws:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    08-24-2005
    Location
    Ireland
    MS-Off Ver
    O365
    Posts
    75

    Re: deleting rows depending on values on another sheet

    Quote Originally Posted by ghynes View Post
    Hey Robert,

    Trying to run the code of every worksheet in the workbook.. is it possible to use ws in the code like below..? is it not working for me.
    I have everything set up correctly for the ws but dont know how to use it in a formula.

    Original:
    Please Login or Register  to view this content.
    Edited with ws:

    Please Login or Register  to view this content.

    I managed to get this sorted by declaring sheetname as string and using it that way.

  11. #11
    Registered User
    Join Date
    08-24-2005
    Location
    Ireland
    MS-Off Ver
    O365
    Posts
    75

    Re: deleting rows depending on values on another sheet

    Have yet another addition I want to make to the macro and wondering the best way to do it! With the player games2 file above.. I am looking to check where the players are in the table points wise, and if the players are 10 or less points away from one another, the game must be removed from sheet1. for eg... Abraham Vs Zack must be removed because they are separated by 1 point, Alfonso Vs Jolanda must be removed because they are separated by 10 points, Ali Vs Jonathan must be removed because they are separated by 9 points. Any suggestions?

+ 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