Results 1 to 7 of 7

Thread: Deleting multiple entries in betting-odds Data

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    3

    Post Deleting multiple entries in betting-odds Data

    Hey,

    I currently have about 60 .csv files with soccer odds data that I need to "clean". Please see my raw data in the attached file.

    What I want to do is to delete all entries that have "IP" in column P. This isnt to hard, and Ive been able to write a code to do so. The next step is more tricky though. My data includes all matched bets on a certain football match. I need to slim this down to one single price. This means that for each "SELECTION" in column I, I either want to delete all multiple entries except the one with the highest value in column L. Or I want to merge all the entries to one row which is a weighted average of the odds at different volumes.

    The last approach is the most tricky one, so I would be happy with the first approach, i.e. deleting all multiple entries except the largest one.

    Would anyone be able to assist me with writing this code? Ideally it would first delete all entries that has "IP", then delete all multiple entries in column I except the one with the largest value for column L.

    I have no idea how to write this code
    Attached Files Attached Files

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Deleting multiple entries in betting-odds Data

    Welcome to the Forums :Waves:

    When you say delete, Do you mean clear the cell?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Deleting multiple entries in betting-odds Data

    you want to do this in excel?

    in excel you can use worksheet functions to return the average, using sumif / countif
    or there may be better alternatives
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    3

    Re: Deleting multiple entries in betting-odds Data

    I wish to delete the rows, so I end up with a excel file with one quote for each outcome, in each game.

    E.g. for a game like ManUtd - Blackburn I will only have three rows, showing the highest matched quote for ManUtd to win, the draw and Blackburn to win.

    Does that make things more clear?

    I wish to use VBA to write a code to automate the process. I could do it "manually", but that would take me a lot of time given I have 50-60 files to go through...

  5. #5
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Deleting multiple entries in betting-odds Data

    Ok I got it...

    Here is one approach...

    If you know how to record macros (If you don't then see Rob's tutorial in Office FAQ's)

    1) Use autofilter to delete all entries that have "IP" in column P
    2) Sort the data based on Col I.
    3) and then loop through rows to delete rows which have duplicate entries in Col P. You can use the Max() function to find out which cell has the max value in Col L and not delete that...

    Well, give it a try... If you are stuck then simply post the code that you have tried and we will definitely help
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    3

    Re: Deleting multiple entries in betting-odds Data

    Sounds great! I'll give it a try tomorrow morning.

    I use the macro recorder to record the initial statement, and then edit the code to write the "delete loop"? Right?

    Ill definately run in to trouble, as Im pretty retarded with VBA, so I'll get back to you tomorrow.

    Thanks for your help

  7. #7
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Deleting multiple entries in betting-odds Data

    I use the macro recorder to record the initial statement, and then edit the code to write the "delete loop"? Right?
    You got that right

    Also since you mentioned that you will have to do that with 50-60 files then I also recommend going through Si_the_Geeks tutorial on how to work with Excel Application (You will see a link in his signature). That will make you job easier... Well this will come later... First see how it works for a single file
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width