+ Reply to Thread
Results 1 to 3 of 3

Help with three columns find unique data

  1. #1
    Registered User
    Join Date
    07-14-2006
    Posts
    3

    Help with three columns find unique data

    Okay,

    I have three columns, A B C

    A holds multiple occurrences of once appearing data in B.

    eg

    A B C

    10
    10
    10
    10 10 5
    11
    11
    11
    11 11 6


    I need a script that will read A, find that value in B and paste corresponding C value in D.

    So for the above example D would be

    5
    5
    5
    5
    6
    6
    6
    6


    I don't know where to even start.

    HELP!

  2. #2
    Greg Wilson
    Guest

    RE: Help with three columns find unique data

    This is one interpretation. Minimal testing.

    Sub Test123()
    Dim c As Range, cc As Range
    Dim r As Range
    Dim ws As Worksheet
    Dim v As Integer 'change data type to suit

    Set ws = ActiveSheet
    Set r = ws.Columns(2).SpecialCells(xlCellTypeConstants)
    For Each c In r.Cells
    If IsNumeric(c.Value) Then
    v = c(1, 2)
    Set cc = c(1, 0)
    Do Until cc.Value <> c.Value
    cc(1, 4) = v
    If cc.Row = 1 Then Exit Do
    Set cc = cc(0)
    Loop
    End If
    Next
    End Sub

    Regards,
    Greg

    "ColB" wrote:

    >
    > Okay,
    >
    > I have three columns, A B C
    >
    > A holds multiple occurrences of once appearing data in B.
    >
    > eg
    >
    > A B C
    >
    > 10
    > 10
    > 10
    > 10 10 5
    > 11
    > 11
    > 11
    > 11 11 6
    >
    >
    > I need a script that will read A, find that value in B and paste
    > corresponding C value in D.
    >
    > So for the above example D would be
    >
    > 5
    > 5
    > 5
    > 5
    > 6
    > 6
    > 6
    > 6
    >
    >
    > I don't know where to even start.
    >
    > HELP!
    >
    >
    > --
    > ColB
    > ------------------------------------------------------------------------
    > ColB's Profile: http://www.excelforum.com/member.php...o&userid=36350
    > View this thread: http://www.excelforum.com/showthread...hreadid=561356
    >
    >


  3. #3
    Registered User
    Join Date
    07-14-2006
    Posts
    3
    Thanks Greg, worked like a charm.

+ 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