+ Reply to Thread
Results 1 to 6 of 6

Extracting text from cells

  1. #1
    Forum Contributor
    Join Date
    02-12-2008
    Location
    Doha-Qatar
    MS-Off Ver
    Excel 2007
    Posts
    137

    Extracting text from cells

    Hello,

    I am trying to find a way to extract text from a cell, attached is an example of what I have and what the required result is.

    I want to remove all texts starting from the the word “Category” to “Comments “and again all text starting from the word “Customer “ to the word “Paid by”

    Thanks in advance
    Attached Files Attached Files
    Last edited by malnahar; 10-29-2010 at 11:12 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,015

    Re: Extracting text from cells

    Try this formula
    Please Login or Register  to view this content.
    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    02-12-2008
    Location
    Doha-Qatar
    MS-Off Ver
    Excel 2007
    Posts
    137

    Re: Extracting text from cells

    Thank you Alan,

    The number of characters from left is not always 25 characters , this may change , can we insert some other dynamic function other than Left (A2,25)

    Regards

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,015

    Re: Extracting text from cells

    Probably, I will have to look at it a bit later as I am not on my machine that has 2007 on it. It will entail a Left(A2, find(something)) formula.

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

    Re: Extracting text from cells

    In B2 and copied down:

    =SUBSTITUTE(SUBSTITUTE(A2, LEFT(MID(A2, FIND("Category:",A2), LEN(A2)), FIND("Comments:", MID(A2, FIND("Category:", A2), LEN(A2)))-1), ""), LEFT(MID(A2,FIND("Customer:",A2),LEN(A2)), FIND("Paid By:",MID(A2,FIND("Customer:",A2),LEN(A2)))-1), "")


    If you want to try and break that down I've left pieces of the formula in separate cells so you can see what they do. The formula A5 is the simple version of the formula above referring to the pieces of logic in the other colored cells. The mega-formula above is created by inserting the formulas from the colored cells in place of the cell references until the only reference left in the megaformula is the original cell a2.
    Attached Files Attached Files
    _________________
    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!)

  6. #6
    Forum Contributor
    Join Date
    02-12-2008
    Location
    Doha-Qatar
    MS-Off Ver
    Excel 2007
    Posts
    137

    Re: Extracting text from cells

    Many thanks Alan & JBeaucaire , appreciate your help , both were fantastic & generous

    Best regards

+ 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