Forum Discussion

Melise1's avatar
Melise1
Copper Contributor
Jul 31, 2020
Solved

Spreading data contained in column A across to other columns to form a table

I have a copy and paste multi-line data  from a web page which has all gone into column A.  This isn't a text to column use case but one where I want to place data from column A into relevant headed columns

 

I have a sample if that helps.  The major headings are:

COMPANY SECTOR SALES PHONE CITY WEBSITE CONTACT SIC CODE

  • Which solution is now appropriate to your desire?
    Please do not forget that the VBA solution leaves one line free every 10 rows, so that all addresses of the column in the row can be kept apart.



    If you find this helpful, please mark it as "Best Answer" and as Like (click thumbs up), it will be beneficial to more Community members reading here.

    Nikolino
    I know I don't know anything (Socrates)

13 Replies

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    Melise1 

    Although there is a lot built in with Power Query, here is a small additional solution with VBA ... simple but effective.
    Open with the worksheet and press the button. If you press it several times, you will see that it can continue to enter as you imagine.
     
    • Melise1's avatar
      Melise1
      Copper Contributor

      NikolinoDE  Thanks...I think the translation from German to English did not make complete sense. Thanks for your help anyway!  M

      • NikolinoDE's avatar
        NikolinoDE
        Gold Contributor
        Which solution is now appropriate to your desire?
        Please do not forget that the VBA solution leaves one line free every 10 rows, so that all addresses of the column in the row can be kept apart.



        If you find this helpful, please mark it as "Best Answer" and as Like (click thumbs up), it will be beneficial to more Community members reading here.

        Nikolino
        I know I don't know anything (Socrates)
  • TheAntony's avatar
    TheAntony
    Iron Contributor

    Melise1 , I took a shot at this using Power Query. It's now perfect since the data in the column A is not consistent. There is no pattern that holds for all items past the Sector. Take a look at the solution and let me know if maybe there's a way to describe the input data pattern that can be used to automate the task.

      • TheAntony's avatar
        TheAntony
        Iron Contributor

        Melise1 , the tricky part is not every item has the same 10 parts. For example, "Little Wickets" does not have the "Sales" part and this makes it difficult to automate.

        Little Wickets (East Midlands) Ltd
        Amusement And Recreation Services, Sports
        441159248476
        Nottingham, Nottinghamshire
        http://littlewickets.com/
        1
        79
        CRM

         

        You mentioned that you copied and pasted from a website. Does the website have the data formatted in a way that includes all the parts? Perhaps the manual copy/paste messed things up. Can you check to see if you can get a more consistent data set?

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    Melise1 

     

    Once without a VBA

    If you liked my solution, please mark it as the correct answer ... if possible with a like so that everyone else can be informed. If you didn't like my answer, please give me a quick feedback.

     

    thank you
    Nikolino
    I know I don't know anything (Socrates)

    • Melise1's avatar
      Melise1
      Copper Contributor

      NikolinoDE  Hi Nikolino....not quite what was looking for....more like this:

       

      take the lines of info under each company name and moving them to the same line as the company name but in their own column.  make sense?  Thanks! Melise

  • Hello,

    Rather than using copy and paste method to copy data from web, you could have used the Power Query to fetch the data from the website. Then, you can clean and transform the data us in Power Query

    You can watch the video in the link below

    https://m.youtube.com/watch?v=NdUZx_yyEqY
    • Melise1's avatar
      Melise1
      Copper Contributor

      Abiola1 

       

       

      Foiled!  I'm using Chrome, BTW.  Any way around this?  Thanks....

      Also, I'm wanting to move to columns as labeled in this snip:

      Thanks! Melise

       

       

       

Resources