+ Reply to Thread
Results 1 to 8 of 8

CSV file with two columns multiple values separated by pipe. Need to Combine

  1. #1
    Registered User
    Join Date
    04-20-2012
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    14

    CSV file with two columns multiple values separated by pipe. Need to Combine

    Hello,

    I have a CSV file with two columns. One "Sizes" and second "Stock" both with multimple values like L|M|S|XL|XXL and 17|16|11|21|18. I have to combine those column in a new column like this:

    L:17|M:16|S:11|XL:21|XXL:18

    Can anyone help me to do that?

    Also i want to calculate sum of stock. That means a new column " Total Stock" and make a sum with all values separated by pipe |

    I attached the file.

    God bless you and your family.
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: CSV file with two columns multiple values separated by pipe. Need to Combine

    Run this macro on your data sheet, it will output to column C:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-20-2012
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: CSV file with two columns multiple values separated by pipe. Need to Combine

    I don't know where to put this code. Please explain. At fx? Can you do that for me and attach the file. Thank you

  4. #4
    Registered User
    Join Date
    04-20-2012
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: CSV file with two columns multiple values separated by pipe. Need to Combine

    I found out how to run that script. It is working perfect. Now can you please how to calculate SUM of stock. Thank you very much.

  5. #5
    Registered User
    Join Date
    06-20-2012
    Location
    Melbourne Australia
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: CSV file with two columns multiple values separated by pipe. Need to Combine

    It would help if you attached a file so we can see where you are pulling your values from. Upload without confidential information.

    Thanks,
    Diana

  6. #6
    Registered User
    Join Date
    04-20-2012
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: CSV file with two columns multiple values separated by pipe. Need to Combine

    I uploaded the file. Is in my first post.

  7. #7
    Registered User
    Join Date
    06-20-2012
    Location
    Melbourne Australia
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: CSV file with two columns multiple values separated by pipe. Need to Combine

    Hello Niky,

    Where are the values you need to Sum?

    Diana

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: CSV file with two columns multiple values separated by pipe. Need to Combine

    Hi nikythebest,

    Here is another way to do this problem without needing any vba code. See the attached.

    Start with your data on Sheet1.
    Copy Column A from Sheet1 to Sheet2 and then Convert it to Text using the | delimiter.
    Copy Column B from Sheet1 to Sheet3 and then Convert it to Text using the | delimiter.
    Then on Sheet4 create a formula to combine Sheet 2 and 3 with a ":" in between each.

    Then using Column A of Sheet 4 use my formula to rebuild to what you want and get rid of extra "|:" characters
    Then in Column B go back to all the numbers in Sheet3 and simply sum them to get that last answer you wanted.

    I hope this helps.

    It is a little process but you don't need any VBA code to do it.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: CSV file with two columns multiple values separated by pipe. Need to Combine

    Quote Originally Posted by nikythebest View Post
    I found out how to run that script. It is working perfect. Now can you please how to calculate SUM of stock. Thank you very much.
    Your post #1 was clear and demonstrated your goal. You'll need to amend your sample workbook (it doesn't need to have that much sample data in it...) and manually mockup you actual final desired result. Don't keep "developing it" and moving the goal post, figure out now what you need it to look like and show us that.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1