Results 1 to 10 of 83

Thread: Delete rows based on match criteria in two excel files or single Excel File

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0

    Conditionally compare the data & delete entire row

    Hi, I am looking for a macro that will do the things as mentioned below

    If column J of 1.xls has buy & column H of 1.xls is not greater than column D of 1.xls then match column I data of 1.xls with column B of alert.xls and if it matches then delete that entire row of alert.xls
    If column J of 1.xls has a blank cell then match column I data of 1.xls with column B of alert.xls and if it matches then delete that entire row of alert.xls
    If column J of 1.xls has short & column H of 1.xls is Greater than than column D of 1.xls then match column I data of 1.xls with column B of alert.xls and if it matches then delete that entire row of alert.xls



    These are the three condition that macro will follow and based on that it will work
    all files are located in different path, macro will be placed in separte file macro.xlsm
    sheet name can be anything

    https://www.excelforum.com/excel-pro...ml#post5340172
    This link has solved the solution by considering alert.csv but now it is changed to alert.xls
    Attached Files Attached Files

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Quote Originally Posted by fixer View Post
    ...https://www.excelforum.com/excel-pro...ml#post5340172
    This link has solved the solution by considering alert.csv but now it is changed to alert.xls
    The solution here, https://www.excelforum.com/excel-pro...ml#post5340172 , was optimised for using a text file as Alert.csv , using advanced Text file data manipulation techniques
    There is no useful coding information there which can be applied to the current requirement : The macro from jindon is no use in the current question here.




    If column J of 1.xls has BUY & column H of 1.xls is not greater than column D of 1.xls then match column I data of 1.xls with column B of alert.xls and if it matches then delete that entire row of alert.xls
    If column J of 1.xls has a blank cell then match column I data of 1.xls with column B of alert.xls and if it matches then delete that entire row of alert.xls
    If column J of 1.xls has SHORT & column H of 1.xls is Greater than column D of 1.xls then match column I data of 1.xls with column B of alert.xls and if it matches then delete that entire row of alert.xls
    row 3 & row 4 & row 5 will be deleted after running the macro


    Before:
    _____ Workbook: 1.xls ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I J
    1 Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    2 NSE ACC EQ
    1183.72
    1240
    1161.6
    1227.1
    1227.1
    22
    BUY
    3 NSE ADANIENT EQ
    139.38
    141.2
    136.6
    138.1
    140
    25
    BUY
    4 NSE ADANIPORTS EQ
    311.85
    315
    306.55
    310.6
    312
    15083
    SHORT
    5 NSE ADANIPOWER EQ
    33.165
    34.5
    32.85
    33
    33.2
    17388
    SHORT
    6 NSE AMARAJABAT EQ
    594
    613.5
    586.9
    592.55
    594
    100
    7 NSE ASIANPAINT EQ
    1584.488
    1625
    1555.4
    1617.9
    1617.9
    236
    BUY
    Worksheet: 1-Sheet1 9 June

    _____ Workbook: Alert.xls ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I J K
    1 NSE
    236
    6
    >
    431555
    A GTT
    2 NSE
    25
    6
    >
    431555
    A GTT
    3 NSE
    15083
    6
    >
    431555
    A GTT
    4 NSE
    17388
    6
    >
    431555
    A GTT
    5 NSE
    100
    6
    >
    431555
    A GTT
    6 NSE
    22
    6
    >
    431555
    A GTT
    Worksheet: Alert 9 June xls

    After running macro here: https://excelfox.com/forum/showthrea...ll=1#post13733


    _____ Workbook: Alert.xls ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I J K
    1 NSE
    236
    6
    >
    431555
    A GTT
    2 NSE
    25
    6
    >
    431555
    A GTT
    3 NSE
    22
    6
    >
    431555
    A GTT
    4
    5
    6
    Worksheet: Alert 9 June xls



    Alan





    macro.xlsm : https://app.box.com/s/z358r7tbc9hzthi539dlj49jsf4gyg8p
    1.xls : https://app.box.com/s/38aoip5xi7018y9syt0xe4g04u95l6xk
    Alert.xls : https://app.box.com/s/ectstkrcfnuozys9tmdd0qi3tdvyxb3w
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Similar Threads

  1. Replies: 29
    Last Post: 06-09-2020, 06:00 PM
  2. Replies: 3
    Last Post: 10-20-2015, 12:51 PM
  3. VBA To Delete Rows Based On Value Criteria In A Column
    By jffryjsphbyn in forum Excel Help
    Replies: 1
    Last Post: 08-15-2013, 12:45 PM
  4. Replies: 6
    Last Post: 08-14-2013, 04:25 PM
  5. Delete Remove Rows By Criteria VBA Excel
    By marreco in forum Excel Help
    Replies: 5
    Last Post: 12-20-2012, 05:56 PM

Tags for this Thread

Posting Permissions

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