+ Reply to Thread
Results 1 to 21 of 21

filter features+macro

  1. #1
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    filter features+macro

    hello
    im after something which im not in all honesty quite sure how to go about

    i have data in a very large workbook that basically looks like a huge fixture list

    column a = home score
    column b = home team
    column c = "v"
    column d = away team
    column e = away score

    i want to be able to search via a userfom in two different ways

    1 section would have input team
    so it would then look for that team name in column b and column d and return all the results in sheet 2
    eg lets use man utd
    it then searches all b and d and returns all results into sheet 2

    section 2 would be
    team v team
    it would need to be able to search for the first input teamin columns b and d
    and
    search for the second input team via columns b and d then return the details on sheet 3

    i need it to do this for me rather than filter and copy and paste as that takes too much time

    many thanks for any help you may give
    Last edited by excellentexcel; 01-09-2009 at 10:32 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    It would help us help you if you could post a small example of your data.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    Thanks andy
    attached
    very basic ss
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    when worbook opens i would like a userform to pop up

    top section
    input team name

    bottom section
    input team name v input team name

    if top section i entered arsenal
    it would return
    1 arsenal v barnsley 3 AND
    1 norwich city v arsenal 3 ( because arsenal is in column b and d for both of these records )

    yet if i used the bottom section and input arsenal v norwich
    it would return
    1 norwich city v arsenal 3 (because this is the only time they have met and arsenal even though arsena are away)

    hope thats explanatory
    Last edited by excellentexcel; 01-08-2009 at 10:58 AM.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    Try this.
    You will need to update the clubs list for full data set.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    thanks andy
    now going to take a look
    regards

  7. #7
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    thanks andy thats great
    any chance you could spare a couple of mins to explain how it works so i can get a better understanding
    and how i could go about utilising the code and expanding it so i could add things like corners etc etc

    many thanks

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    Basically the routine compares team name against content of column b or d for each row.
    If the names match then the row of data is copied to the appropriate sheet.

    Was there something specific you need help understanding?

  9. #9
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    well actually yes there is and thanks for asking

    i was hoping to maybe use this in other things but along the same lines
    off my head lets say a dart database i keep

    column a = tournament
    column b = 180's
    column c = players average
    cloumn d = player 1
    column e = score (home)
    column f = score (away)
    column g = player 2
    column h = players average
    column i = 180's

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    okay but what's the question?

  11. #11
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    if i just transferred that data to that sheet would that work?
    ie
    if i type eric bristow v bobby george
    would it return the results?

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    The code should work but you will need to adjust the range references.

    team names are in columns b and d or 2 and 4.
    where as player names are in d and g or 4 and 7.

    you would also need to change the sheet of club names for a sheet of player names.

  13. #13
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    hi andy
    i have attached my darts sheet
    if you could tell me what i need to change that would be great and i could learn from that
    as you will see things are in a different order
    Attached Files Attached Files

  14. #14
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    So taking the routine and making this small change means you can use it for both football or darts by just changing 2 variables

    Please Login or Register  to view this content.

  15. #15
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    I posted my code before I saw your darts data file.
    The code is valid still but you also need to make a change to the calling code in order to pick up the extra information.
    So you need to increase the Resize value to cover more columns

    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    hi andy
    thanks for your patience
    i have this code and its returning this line red

    Please Login or Register  to view this content.
    this is the full code i have

    Please Login or Register  to view this content.

  17. #17
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    That's because you have changed the functions signature.

    You need to change the call to that function. These are within the Click event of the 2 buttons.

  18. #18
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    not sure i understand what you mean
    no ok be honest i dont know what you mean
    i have used the code you put up and dont know where u mean now

  19. #19
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    see attached.

    I copied dart data in to the workbook and adjusted code accordingly
    Attached Files Attached Files

  20. #20
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    thanks andy
    will print both sets of codes and compare them against each other with both workbookd open
    it will help me get a better understanding
    thanks vey much

  21. #21
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    ive got it
    many thanks for all your help andy

+ 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