Copy Values to another column based on Keyword

  • I have a spreadsheet containing a list of Devices and their meters in Column A. Each device has a different number of meter runs associated with it. ex A1=Device , A2 = Meter 0, A3 = Meter 1 etc. Column B holds the Device name and the corresponding meter runs names. I need to take the device name and add that to Column C next to the corresponding meter runs for each device. I have attached a small sample to illustrate what the current worksheet looks like. Sheet 1 displays the current data set and sheet 2 contains what the solution data set should look like.

    I have roughly 10,000 meter runs what would be the easiest way to accomplish what I need?

    Here is the only other place I have posted the same/similar question.…column-a.html#post5192600

    Thank you everyone for your help.

  • Your post does not comply with our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    No help to be offered until OP complies.

  • Code
    1. Sub Maybe()
    2. Dim c As Range
    3. For Each c In Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
    4. If c.Value Like "Meter " & "*" Then
    5. c.Offset(, 2).Value = Columns(1).Find(What:="Device*", After:=c, SearchDirection:=xlPrevious).Offset(, 1).Value
    6. End If
    7. Next c
    8. End Sub

    Note. In your example you have spaces as last character. The asterisk (*) will take care of that problem.

  • Extremely pleasant to answer a request ... and never get feedback from the Original Poster ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Like" icon ...just the bottom right corner...:)