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
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    How about this….

    What is wanted….
    ….. I have two workbooks, STEP1U.xlsb and 1.xls
    There is a data range in the first worksheet of both workbooks, from rows 2. ( I have a header range in rows 1 )

    Compare/ Consider column A in the first worksheet of STEP1U.xlsb with column B in the first worksheet of 1.xls. ( Ignore the first row – this is the header row )

    If the value in column B in the first worksheet of 1.xls is not in column A in the first worksheet of STEP1U.xlsb , then the entire row , ( in 1.xls ), containing that value is to be deleted.
    ( STEP1U.xlsb is not changed )

    Alternative short explanation: Delete all the rows in 1.xls whose value in column B is not to be found in column A in STEP1U.xlsb. ( STEP1U.xlsb remains unchanged )


    Before:-
    _____ Workbook: STEP1U.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    1
    2
    ACC
    100
    3
    DLF
    150
    4
    Worksheet: Sheet1

    _____ Workbook: 1.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    1
    Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    2
    NSE ACC EQ
    1014
    1030
    955.5
    998.45
    957.4
    3
    NSE ADANIPOWER EQ
    27.35
    27.75
    25.65
    25.65
    25.85
    4
    NSE DLF EQ
    390
    419.7
    350.05
    387.25
    352.4
    5
    NSE AMBUJACEM EQ
    145.1
    155.8
    142.55
    145.85
    145
    6
    NSE APOLLOHOSP EQ
    1250
    1265
    1124.15
    1158.65
    1127.05
    7
    Worksheet: 1-Sheet1


    After :-

    _____ Workbook: STEP1U.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    1
    2
    ACC
    100
    3
    DLF
    150
    4
    Worksheet: Sheet1

    _____ Workbook: 1.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    1
    Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    2
    NSE ACC EQ
    1014
    1030
    955.5
    998.45
    957.4
    3
    NSE DLF EQ
    390
    419.7
    350.05
    387.25
    352.4
    4
    5
    Worksheet: 1-Sheet1





    Solution:-

    See here:
    http://www.excelfox.com/forum/showth...ll=1#post12896







    See also some Important notes on looping backwards when deleting rows
    http://www.excelfox.com/forum/showth...ll=1#post12902
    Last edited by DocAElstein; 03-27-2020 at 03:30 AM.

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
  •