We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Microsoft excel query

heppy23
Posts: 478 Forumite

in Techie Stuff
I'm trying to do some work on a big list of stock items.
The list is of various tags that apply to that item.
At the moment the file looks like:-
Item1,green,sock,large
Item2,blue,hat,small
How can I get the file to look like
Item1,green
Item1,sock
Item1,large
Item2,blue
Item2,hat
Item2,small
I need to be able to do it as easily as possible as it's a very large file I'm working on.
The list is of various tags that apply to that item.
At the moment the file looks like:-
Item1,green,sock,large
Item2,blue,hat,small
How can I get the file to look like
Item1,green
Item1,sock
Item1,large
Item2,blue
Item2,hat
Item2,small
I need to be able to do it as easily as possible as it's a very large file I'm working on.
0
Comments
-
what is in each cell now.. is it Item1,green,sock,large in one cell or spread across4?0
-
spread across 4, I need it spread across 2.
Thanks.0 -
Can anyone help with this?0
-
There might be ways of doing it with XML and XSLT, but that may be a bit too involving...0
-
Assuming the info for item 1 is in cells A1, A2, A3 and A4 you could try:
=A1&A2
=A1&A3
=A1&A4
or look up the use of concatenate in Excel as I think that will do what you want.
HTH0 -
It's a simple copy and paste job.
Insert some extra columns, and copy and paste the data from your items column into them, so you end up with:
Item1,green,Item1,sock,Item1,large
Item2,blue,Item2,hat,Item2,small
etc.
Now just cut and paste the second and third pairs of columns on to the end of the first pair of columns. Job done.
If the order in which they appear is important to you, you'll need to temporarily insert additional columns containing order indexes and sort by those before deleting.Stompa0 -
It's a simple copy and paste job.
Insert some extra columns, and copy and paste the data from your items column into them, so you end up with:
Item1,green,Item1,sock,Item1,large
Item2,blue,Item2,hat,Item2,small
etc.
Now just cut and paste the second and third pairs of columns on to the end of the first pair of columns. Job done.
If the order in which they appear is important to you, you'll need to temporarily insert additional columns containing order indexes and sort by those before deleting.
I've been doing it that way but some of the files are 60+ columns wide and I end up losing track.0 -
The suggested solution should work but I do not understand what you mean by " some of the files are 60+ columns wide" ?I am a cow so cannot speak Bullshine but I do recognise its smell when I come upon it.0
-
I've been doing it that way but some of the files are 60+ columns wide and I end up losing track.
I guess you could try adding an additional column containing a character that's not used elsewhere in the data (say @). So you end up with:
Item1,green,@,Item1,sock,@,Item1,large
Item2,blue,@,Item2,hat,@,Item2,small
now save it as a text file, load it into a text editor, replace all occurrences of ',@,' with a carriage return, and reimport the modified file back into Excel.
It would also be easier to let Excel do the hard work when inserting the extra columns, so add them all to the right, with an additional row somewhere containing indexes indicating the final order, then sort by that additional row to get them in the right place.Stompa0 -
can you not do a CSV export or something like that
mmmmm thats a tricky one i have been trying it and it may take some time
would be easier to get it into a database0
This discussion has been closed.
Confirm your email address to Create Threads and Reply

Categories
- All Categories
- 352.1K Banking & Borrowing
- 253.6K Reduce Debt & Boost Income
- 454.2K Spending & Discounts
- 245.1K Work, Benefits & Business
- 600.7K Mortgages, Homes & Bills
- 177.5K Life & Family
- 258.9K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.1K Discuss & Feedback
- 37.6K Read-Only Boards