Announcement

Collapse
No announcement yet.

Copy Values to another column based on Keyword

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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. https://www.excelforum.com/excel-gen...ml#post5192600

    Thank you everyone for your help.
    Attached Files
    Last edited by guysamson; 6 days ago. Reason: Edited to include a cross post link to another forum I asked the same question.

  • #2

    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 https://www.excelguru.ca/content.php?184 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.
    Alan

    Did you debug your code first? http://www.cpearson.com/excel/DebuggingVBA.aspx
    FORUM RULES----->http://www.ozgrid.com/forum/announcement.php?f=8

    If someone has helped you, say "thank you" by clicking on the Like Button.

    Comment


    • #3
      I have amended my original post to include the cross posted link. Any help provided will be greatly appreciated.

      Thank you,

      Russell

      Comment


      • #4
        Hello,

        Attached is your test file

        Hope this will help
        Attached Files
        If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

        Comment


        • #5
          Once you have tested the macro... feel free to share your comments
          If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

          Comment


          • #6
            Code:
            Sub Maybe()
            Dim c As Range
                For Each c In Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
                    If c.Value Like "Meter " & "*" Then
                        c.Offset(, 2).Value = Columns(1).Find(What:="Device*", After:=c, SearchDirection:=xlPrevious).Offset(, 1).Value
                    End If
                Next c
            End Sub
            Note. In your example you have spaces as last character. The asterisk (*) will take care of that problem.

            Comment


            • #7


              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 ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

              Comment

              Working...
              X