Results 1 to 3 of 3

Thread: Comparing data values between worksheets *resolved*

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    24

    Comparing data values between worksheets *resolved*

    I have a database that has two buttons that imports data from a table to a worksheet in excel. Each button copies different data to different worksheets.

    My problem is that I have this data and I need to compare them for non duplicates and output that result in a third worksheet. An example will be given.

    Worksheet 1

    1
    2
    3
    4
    6
    7

    Worksheet 2

    1
    2
    3
    4
    5
    6

    I need to compare worksheet 2 to worksheet 1 so that in worksheet 3 it gives me

    5


    I'm tried racking my brains on how to do this in excel, but I can't figure it out for the life on me. I know what i need to do but I don't know the right way about it

    Puedsocode


    If cells in Sheet2 is Not Equal to cells in Sheet 1 Then

    Ouput result to worksheet3
    End If


    Any help would be great

    Thanks
    Last edited by Decosta; May 1st, 2003 at 11:16 AM.

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    As fas as your pseudocode, it should look like this:
    VB Code:
    1. For i=1 to 10
    2. For j= 1 to 10
    3. If ActiveWorkbook.sheets("Sheet1").Cells(i,j).Value <> ActiveWorkbook.sheets("Sheet2").Cells(i,j).Value  Then
    4.  
    5. ActiveWorkbook.sheets("Sheet3").Cells(i,j).Value = ActiveWorkbook.sheets("Sheet1").Cells(i,j).Value
    6. End If
    7. Next j
    8. Next i
    But that does not match your example!
    It will put an entry in Sheet3 if Sheet1 does not match Sheet2, an entry is made into the same cell in Sheet3.
    In your example Sheet3 would get entries in the row 5 and row 6!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    24
    I went back and used Access to compare (used the wizard).. I just hate when you had the answer at the start.. But oh well, live and learn.

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