+ Reply to Thread
Results 1 to 3 of 3

Enhancing formula for extracting text from a single cell

Hybrid View

  1. #1
    Registered User
    Join Date
    07-08-2012
    Location
    Singapore
    MS-Off Ver
    Mac Excel 2011
    Posts
    2

    Enhancing formula for extracting text from a single cell

    Hi there! I've been testing and reading a lot of articles for excel, but it now comes to the point of desperation, and I am seeking your help to finally solve my problem. Please help!

    Case: I need to extract words from a single cell and display them. With SEARCH, FIND, LEFT/MID/RIGHT functions, this should be easy, but it becomes trickier here.

    Examples: These are the sample contents I'm working on;

    In*Master Stock Transfer File, G***** C**** added Preview of “SI-1234”.pdf and 23 more files.
    In*Master Stock Transfer File, D*** H***** P****** deleted the folder untitled folder.

    (Names are replaced with asterisk for confidentiality)

    ^Those are exactly the contents of the cell. The challenges are; I need to extract the names, the action (e.g. added), and the file modified (located at the last part of each sentence). Problems are:


    1. Extracting names: I used the MID function for this-
    Formula: copy to clipboard
    =MID(B3,FIND(",",B3)+2,11)&"."

    -but since each person has different number of words per name, I opted to choose the first 11 then finish it with '.', resulting to-
    Formula: copy to clipboard
    G***** C*.

    -this should be workable, but if there are better formulas out there, that'd be great!


    2. Extracting the action: I came up with a formula using SEARCH (to find the word 'added'), then IF (if True, displays the word 'added'). I set the False argument to loop another IF(SEARCH formula for 'deleted', and then agin for other words. Only added was successful, and if it's SEARCHing for deleted, it shows an error. I need more help on this one.

    3. Extracting the file modified: I used RIGHT for this one, but since not all files share the same number of characters, it will display only a fragment of the whole string I wanted to display. Is there any formula that will allow me to copy all the words after a set examples of words (after added and deleted).

    That would be it. Thanks, any help will be appreciated. =)

  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: Enhancing formula for extracting text from a single cell

    TO keep it simple, you need to get the ADDED/DELETED first. Meanwhile, here are the three formulas:

    A1: Your text
    B1: =TRIM(LEFT(SUBSTITUTE(MID(A1, FIND(", ", A1)+2,1000), C1, REPT(" ", 1000)),1000))
    C1: =IF(ISNUMBER(SEARCH("added", A1)), "added", "deleted")
    D1: =TRIM(RIGHT(SUBSTITUTE(A1, C1, REPT(" ",1000)), 1000))
    _________________
    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
    07-08-2012
    Location
    Singapore
    MS-Off Ver
    Mac Excel 2011
    Posts
    2

    Re: Enhancing formula for extracting text from a single cell

    Thank you so much JBeaucaire! The load on my work has been cut off by a lot. I'm studying the formulas you have given to me, hopefully I'll manage to make my own when I need to add more to my workbook. Thanks again!

+ 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