Results 1 to 10 of 30

Thread: Delete rows based on match criteria in two excel files, 1 might be .csv file .Opened in Excel=Fail Chaos

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #13
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10

    Conditionally compare the data & delete entire row

    _____ 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 29May excelforum

    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 second field ( column B ) of text file , alert.csv and if it matches then delete that entire record (row) of alert.csv
    If column J of 1.xls has a blank cell then match column I data of 1.xls with second field ( column B ) of of text file , alert.csv and if it matches then delete that entire record (row) of alert.csv
    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 second field ( column B ) of of text file , alert.csv and if it matches then delete that entire record (row) of alert.csv



    Text file from https://www.excelforum.com/excel-pro...ml#post5339877
    Alert 29May excelforum..csv : https://app.box.com/s/t8c9p6a0lqulknofdb7a22046r0943uv
    AlertDotexcelforum29May.JPG : https://imgur.com/kgtz7Nk
    AlertDotexcelforum29May.jpg
    File as seen by ADO stuff… ( )
    Records\Fields F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11
    Record1 NSE 236 6 > 431555 A GTT
    Record2 NSE 25 6 > 431555 A GTT
    Record3 NSE 15083 6 > 431555 A GTT
    Record4 NSE 17388 6 > 431555 A GTT
    Record5 NSE 100 6 > 431555 A GTT
    Record6 NSE 22 6 > 431555 A GTT
    Record7
    Record8
    Record9 row 3 & row 4 & row 5 will be deleted after runing the macro





    _____ Workbook: 1.xls ( Using Excel 2007 32 bit )
    Row\Col D H I J K L M N O P Q R
    1 Open LTP If column J of 1.xls has buy & column H of 1.xls is not greater than column D of 1.xls If column J of 1.xls has short & column H of 1.xls is Greater than than column D of 1.xls If column J of 1.xls has a blank cell
    2
    1183.72
    1227.1
    22
    BUY FALSE FALSE FALSE
    3
    139.38
    140
    25
    BUY FALSE FALSE FALSE
    4
    311.85
    312
    15083
    SHORT FALSE
    15083
    FALSE
    5
    33.165
    33.2
    17388
    SHORT FALSE
    17388
    FALSE
    6
    594
    594
    100
    FALSE FALSE
    100
    7
    1584.488
    1617.9
    236
    BUY FALSE FALSE FALSE
    Worksheet: 1-Sheet1 29May excelforum

    _____ Workbook: 1.xls ( Using Excel 2007 32 bit )
    Row\Col D H I J K L M N O P Q R
    1 Open LTP If column J of 1.xls has buy & column H of 1.xls is not greater than column D of 1.xls If column J of 1.xls has short & column H of 1.xls is Greater than than column D of 1.xls If column J of 1.xls has a blank cell
    2
    1183.72
    1227.1
    22
    BUY =IF((J2:J7="buy")*(H2:H7),I2:I7) =IF((J2:J7="short")*(H2:H7>D2:D7),I2:I7) =IF(J2:J7="",I2:I7)
    3
    139.38
    140
    25
    BUY =IF((J2:J7="buy")*(H2:H7),I2:I7) =IF((J2:J7="short")*(H2:H7>D2:D7),I2:I7) =IF(J2:J7="",I2:I7)
    4
    311.85
    312
    15083
    SHORT =IF((J2:J7="buy")*(H2:H7),I2:I7)
    =IF((J2:J7="short")*(H2:H7>D2:D7),I2:I7)
    =IF(J2:J7="",I2:I7)
    5
    33.165
    33.2
    17388
    SHORT =IF((J2:J7="buy")*(H2:H7),I2:I7)
    =IF((J2:J7="short")*(H2:H7>D2:D7),I2:I7)
    =IF(J2:J7="",I2:I7)
    6
    594
    594
    100
    =IF((J2:J7="buy")*(H2:H7),I2:I7) =IF((J2:J7="short")*(H2:H7>D2:D7),I2:I7)
    =IF(J2:J7="",I2:I7)
    7
    1584.488
    1617.9
    236
    BUY =IF((J2:J7="buy")*(H2:H7),I2:I7) =IF((J2:J7="short")*(H2:H7>D2:D7),I2:I7) =IF(J2:J7="",I2:I7)
    Worksheet: 1-Sheet1 29May excelforum
    Last edited by DocAElstein; 06-07-2020 at 07:12 PM.

Similar Threads

  1. Delete One Row From A 2D Variant Array
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 18
    Last Post: 02-23-2020, 03:10 PM
  2. Replies: 6
    Last Post: 03-26-2014, 03:04 PM
  3. Replies: 1
    Last Post: 02-25-2014, 10:55 PM
  4. Delte a specific column and does not delete the top row
    By jffryjsphbyn in forum Excel Help
    Replies: 1
    Last Post: 06-13-2013, 02:00 PM
  5. Replies: 4
    Last Post: 03-22-2013, 01:47 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
  •