+ Reply to Thread
Results 1 to 6 of 6

Slightly complex macro

  1. #1
    Registered User
    Join Date
    01-20-2014
    Location
    Germany
    MS-Off Ver
    Excel 2011
    Posts
    3

    Slightly complex macro

    Hello everyone,

    I am a college student from Germany working on my Master's thesis. I am working on Machine Learning approaches that need annotated sentences. These sentences are available to me in the form of .csv files that can be read by Excel (my version is OSX 2011). My problem is the following:

    Table definition:

    ID_A | ID_B | Description | Label_{A, ... , Z}

    Description is a single text that has been produces by a piece sentence splitting code. Each sentence can be annotated with SEVERAL different labels. This is because different parts of a sentence can describe different labels. Consider: "This is a good book, but the characters are very weak."

    "This is a good book" would receive a different label than "but the characters are very weak."

    Now, I need a macro command, that splits such a sentence. The best way (for a number of reasons) would be to put the cursor inside that cell and split the Description text at that cursor. Copy the cut off part into a new line below and copy every OTHER cell of the original one into the newly created as well.

    I am fairly accomplished with a large number of programming languages, Visual Basic is not one of them. I would be very grateful for some specific advice, maybe relatable code that I can work on or information of such nature.

    Best of thanks
    Apophis

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Slightly complex macro

    Are the different parts always separated by a comma? If so, you could run a subroutine on each cell in the range, split if there is a comma and insert to a new row. If you would like to have a subroutine worked up, I would need a lot more information otherwise I would be guessing a lot.

  3. #3
    Registered User
    Join Date
    01-20-2014
    Location
    Germany
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: Slightly complex macro

    Hello stnkynts,

    thank you for your reply.

    The parts, or lets say phrases, are > not < always separated by comma. It is a freely defined text, more specifically an online review. As you can imagine, really anything goes in terms of text style. I frequently see ",.-+=" being used for separators or even for enumeration.

    I initially tried to separate at commas, but the problem is, that sentences such as: "Therefore, the monkey clubbed the chicken." get split apart as well, when clearly "Therefore" is semantically dependent on the right phrase.

    Are these the informations you need? I am happy to provide what ever you need to point me in the right direction.

  4. #4
    Registered User
    Join Date
    01-20-2014
    Location
    Germany
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: Slightly complex macro

    This is my current point of work:

    Please Login or Register  to view this content.
    Obviously, the shift & copy works, but regarding the phrase splitting, I have no idea how to accomplish that.
    Last edited by arlu1201; 01-21-2014 at 09:37 AM.

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Slightly complex macro

    Apophis,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. In order to put code tags, either type [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] at the end of it, OR you can highlight your code and click the # icon at the top of your post window.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Slightly complex macro

    Also,

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request.

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Slightly complex delivery sheet for bakery
    By twigdip in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-23-2013, 09:50 AM
  2. [SOLVED] Slightly complex Concatenate with IFS - help appreciated!!
    By twigdip in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 08-08-2013, 07:38 AM
  3. complex macro
    By sukhi_01 in forum Excel General
    Replies: 2
    Last Post: 05-16-2008, 06:17 AM
  4. complex macro
    By sukhi_01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2008, 12:06 PM
  5. Slightly complex conversion and date calculation
    By Junior19 in forum Excel General
    Replies: 4
    Last Post: 05-07-2008, 07:16 AM

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