+ Reply to Thread
Results 1 to 7 of 7

Need to pull part of a description into different column

  1. #1
    Forum Contributor
    Join Date
    12-18-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 365
    Posts
    108

    Need to pull part of a description into different column

    Hi,

    I'm fairly new to VBA, and have spent all afternoon searching for a solution to my problem but could not really find what i was looking for.
    (or convert anything that was close enough into whatever I needed...)

    Probably there is a very simple trick to do this, so any help would be highly appreciated!


    The problem:

    In my document, column F is occupied with a description of a product which is supplied by our vendor.
    The description starts with a part number (which is not always the same length in characters!), is then followed by a comma (,) which is then followed by the remainder of the description.

    what I need my macro to do for me is to extract the part number and put this is column E.
    The remainder of the description does not need to be captured in any other column.

    The tricky bit is that some of the descriptions on columns F contain more than 1 comma. Please see below 3 descriptions as examples:
    CAB-ETHXOVER=, ETHERNET CROSS-OVER CABLE
    CISCO2911/K9, Cisco 2911 w/3 GE,4 EHWIC,2 DSP,1 SM,256MB CF,512MB DRAM,IPB
    VWIC2-1MFT-G703=, 1-Port 2nd Gen Multiflex Trunk Voice/WAN Int. Card - G.703


    Keeping my fingers crossed for a good solution....
    Thanks! Marijke

  2. #2
    Registered User
    Join Date
    12-17-2012
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Need to pull part of a description into different column

    Here's what I came up with:

    Please Login or Register  to view this content.
    It also takes out the space between the number and the description. You'll need to add a loop to use it on the whole column.

  3. #3
    Registered User
    Join Date
    12-17-2012
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Need to pull part of a description into different column

    Woah, my bad, I thought you wanted the description without the part number. This gives you the part number, no description:

    Please Login or Register  to view this content.
    I included the loop for you. This assumes there is no title row and your descriptions start in row 1.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Need to pull part of a description into different column

    perhaps you could upload a workbook with a few samples in, so we can play with it?

    and does it have to be VBA?

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Contributor
    Join Date
    12-18-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 365
    Posts
    108

    Re: Need to pull part of a description into different column

    Thanks chris.c
    tried it, and it works but... it works the other way around on my end;
    it pulls the 2nd part of the description into column E, but I need the 1st part.


    Also, how can I create the loop to use it on the whole column?
    Cell Z1 contains a 'counta' formula

    Range("Z1").Formula = "=counta(F1:F65000)"
    x = Range("Z1").Value

  6. #6
    Registered User
    Join Date
    12-17-2012
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Need to pull part of a description into different column

    Noticed that. See my second post above.

  7. #7
    Forum Contributor
    Join Date
    12-18-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 365
    Posts
    108

    Re: Need to pull part of a description into different column

    works perfectly!!!! Thanks chris.c

+ 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