SOLVED

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

Copper Contributor

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

13 Replies
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 

 

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 , 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.

@Abiola1 

 

Melise1_0-1596263819983.png

 

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

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

Melise1_1-1596263916207.png

Thanks! Melise

 

 

 

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

 

Melise1_0-1596264056789.png

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

@TheAntony Wow!  That's it....can you do this for the attached?

@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
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?

@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.
 

@TheAntony  Hi thanks for your help.  Thing is, some fields are empty - rather than inserting a null character, the next line is always a field containing data.  This is the issue.  I did a bit of clean up but the set goes off register because of this.  Thanks anyway!

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

best response confirmed by Melise1 (Copper Contributor)
Solution
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)
Always at your service. Wish you a nice day Nikolino
1 best response

Accepted Solutions
best response confirmed by Melise1 (Copper Contributor)
Solution
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)

View solution in original post