+ Reply to Thread
Results 1 to 6 of 6

Comparing 2 lists

  1. #1
    Registered User
    Join Date
    05-10-2010
    Location
    Telford, England
    MS-Off Ver
    Excel 2003
    Posts
    33

    Comparing 2 lists

    I have a spreadsheet with 2 sheets.
    Sheet 1 - 7 columns, abt 4000 rows
    Sheet 2 - 7 columns, abt 2000 rows.

    7 columns are the same content and format on each sheet.

    I want to create Sheet 3 - again 7 columns
    It must contain ONLY those rows that are in Sheet 2 and not in sheet 1
    I dont think there will be many

    Any any ideas how to go abt this easily - its a one ooff job so doesnt need to be particulary 'user friendly'

    I use office 2007 and am happy working with macros

    I have no idea how to start and would appreciate help

    Thanks
    Last edited by tsrwebman; 02-17-2012 at 08:32 AM.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Comparing 2 lists

    Hi tsrwebman,

    By saying 'those rows' do you mean the entire row contents or there are some key entries which need to be checked only.
    If possible, post a sample file. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Comparing 2 lists

    Hi

    One simple way is this.

    For Column A, try this in Sheet3!A1

    =IF(COUNTIF(Sheet1!$A$1:$A$10;Sheet2!A1)>0;"";Sheet2!A1)

    Copy down. Same for the others.

    .
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Registered User
    Join Date
    05-10-2010
    Location
    Telford, England
    MS-Off Ver
    Excel 2003
    Posts
    33

    Thumbs up Re: Comparing 2 lists

    To clarify:
    (now this isnt suppoosed to be valid code)

    for each row in sheet2
    for each row in sheet 1
    if (Sheet2: thisrow:cells1-7 exactly matches Sheet1:this row: cols 1:7)
    ignore it
    else
    copy sheet2:thisrow to sheet3
    end if
    next row sheet 1
    next row sheet2

  5. #5
    Registered User
    Join Date
    05-10-2010
    Location
    Telford, England
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Comparing 2 lists

    no - thats not quite correct - it would copy all the rows
    try this

    for each row in sheet2
    for each row in sheet 1
    if (Sheet2: thisrow:cells1-7 exactly matches Sheet1:this row: cols 1:7)
    mark as found and exit loop
    else
    mark as not found
    end if
    next row sheet 1
    if not found copy sheeet2:thisrow to sheet3
    next row sheet2
    Last edited by tsrwebman; 02-17-2012 at 09:26 AM.

  6. #6
    Registered User
    Join Date
    05-10-2010
    Location
    Telford, England
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Comparing 2 lists

    I have an idea - as it is a one off job

    is there an array formula version of vlookup .
    I could add a cell at the end of reach row in sheet 2 indicating true/false if the whole row is found in the array of rows on sheet 1.
    Then to see which rows were not found just do a display filter.

+ 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