+ Reply to Thread
Results 1 to 11 of 11

comparing values

  1. #1
    Registered User
    Join Date
    09-10-2008
    Location
    Singapore
    Posts
    27

    comparing values

    Hi guys, on a sheet i have 2 column with values.
    For e.g

    DevID DevNum
    123 s123
    123 s234
    987 sabc
    987 sabc

    Is there a way where i can compare the values in DevNum with the same DevID
    to see if theres any duplicated values using macro?

    Thanks all.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi,

    Why do you need a macro. A simple formula in C2

    Please Login or Register  to view this content.
    and copied down, will return either True or False. Then just filter column C for 'True' values.

    HTH

  3. #3
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    418
    Another simple method is,

    in the third colum,

    Please Login or Register  to view this content.
    this will tell you which items are duplicates

  4. #4
    Registered User
    Join Date
    09-10-2008
    Location
    Singapore
    Posts
    27
    Oh i'm sorry guys, i think you misunderstood me. What i meant to compare is to compare all the values in Column B DevNum with the same corresponding DevID to check for duplicate.

    E.g
    DevID DevNum
    123 sabc
    123 sabc
    123 sdef
    456 shij
    456 sdlo
    456 sgfc

    So in this case, For all DevID "123", corresponding DevNum has duplicates value which is "sabc"

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Maybe

    =IF(SUMPRODUCT(--($A$2:$A$7 & $B$2:$B$7 = A2 & B2) ) > 1, "Dup", "")

  6. #6
    Registered User
    Join Date
    09-10-2008
    Location
    Singapore
    Posts
    27
    Thanks alot Shg do i don't think this would work as the number of values in DevID is dynamic. So sometimes i can have 5 DevID with the same values and sometime more or less.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Then use a dynamic named range.

  8. #8
    Registered User
    Join Date
    09-10-2008
    Location
    Singapore
    Posts
    27
    Sorry but how do i do that?

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Define

    Tbl Refers to: =OFFSET(Sheet1!$A$1, 1, 0, COUNTA(Sheet1!$A:$A) - 1, 2)

    ... and change the formula to

    =IF(SUMPRODUCT(--(INDEX(Tbl, 0, 1) & INDEX(Tbl, 0, 2) = A2 & B2) ) > 1, "Dup", "")

  10. #10
    Registered User
    Join Date
    09-10-2008
    Location
    Singapore
    Posts
    27
    Hey Shg thanks again, but i seriously think i would need a macro. Tried running the code u provided but it kinda "Hang" cause i had to copy that formula in a limit of 10 000 rows

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    OK.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Comparing values in two columns, and highlight if not equal
    By vmc62 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-14-2008, 09:23 PM
  2. comparing values across excel files
    By pipihoward in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-10-2008, 02:16 AM
  3. Comparing values in cells between three worksheets
    By SlipperyPete in forum Excel General
    Replies: 2
    Last Post: 12-10-2007, 04:29 PM
  4. Comparing two values and highlighting using color
    By ramki in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-15-2006, 12:19 PM
  5. Comparing values in two columns
    By DCS in forum Excel General
    Replies: 2
    Last Post: 10-13-2006, 03:41 AM

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