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

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.
«1

Comments

  • what is in each cell now.. is it Item1,green,sock,large in one cell or spread across4?
  • spread across 4, I need it spread across 2.

    Thanks.
  • heppy23
    heppy23 Posts: 478 Forumite
    Part of the Furniture Combo Breaker
    Can anyone help with this?
  • There might be ways of doing it with XML and XSLT, but that may be a bit too involving...
  • KEM
    KEM Posts: 212 Forumite
    Part of the Furniture Combo Breaker
    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.

    HTH
  • Stompa
    Stompa Posts: 8,379 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    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.
    Stompa
  • heppy23
    heppy23 Posts: 478 Forumite
    Part of the Furniture Combo Breaker
    Stompa wrote: »
    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.
  • 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.
  • Stompa
    Stompa Posts: 8,379 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    edited 14 December 2010 at 2:01PM
    heppy23 wrote: »
    I've been doing it that way but some of the files are 60+ columns wide and I end up losing track.
    Ah OK, I didn't realise you were talking about that many columns.

    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.
    Stompa
  • hubert_cumberdale
    hubert_cumberdale Posts: 828 Forumite
    edited 14 December 2010 at 12:13PM
    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 database
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

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

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.