+ Reply to Thread
Results 1 to 14 of 14

Thread: Extracting Text?

  1. #1
    Valued Forum Contributor
    Join Date
    07-16-2007
    Location
    GA
    Posts
    292

    Question Extracting Text?

    Hi,

    I have the following text in cell D3:

    HPT Stg 1 Blade

    I thought this function could work to extract the "1" out of the cell & put into another cell:

    =if(d3="*1*","1").

    I am getting a false answer. What's wrong with this function? More importantly, how can I extract desired text out of it?

    Thanks
    MyCon

  2. #2
    Valued Forum Contributor Haseeb A's Avatar
    Join Date
    05-24-2011
    Location
    India | Kwt
    MS-Off Ver
    2007
    Posts
    1,453

    Re: Extracting Text?

    Try this,

    =LOOKUP(9E300,--MID(0&D3,MIN(FIND({0,1,2,3,4,5,6,7,8,9},D3&"0123456789")),ROW(A$1:A$20)))
    HTH; Haseeb

    If your problem is solved, please say so clearly, and mark your thread as Solved:
    Forum Rules & How to Mark a thread as SOLVED

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Cochrane,Alberta
    MS-Off Ver
    XL 2003,2007,2010
    Posts
    6,843

    Re: Extracting Text?

    Try this out as well
    =IF(ISERROR(FIND(1,D3)),"",1)

  4. #4
    Valued Forum Contributor
    Join Date
    07-16-2007
    Location
    GA
    Posts
    292

    Re: Extracting Text?

    Hi Everyone,

    Thanks for the feedback. I'll try these when I get back to work. I thought there was an Excel wildcard function that looked something like this: "*D3*". Is this correct or is it some other type of format?
    MyCon

  5. #5
    Valued Forum Contributor
    Join Date
    07-16-2007
    Location
    GA
    Posts
    292

    Re: Extracting Text?

    Hi Everyone,

    It appears that just extracting "1" is too broad of an extraction. I am looking to extract "Stage 1, 2, 3 or 4" out of the text found in column B & put a "1, 2, 3 or 4" result in column C.

    Basically, if column B has "Stage" in it, I'm looking for the value, which should be 1, 2, 3 or 4 as the result & put result in column C.

    I modified my original Excel file & took out a few columns.

    See attachment.

    Thanks
    Attached Files Attached Files
    MyCon

  6. #6
    Registered User
    Join Date
    11-06-2011
    Location
    Massachusetts, USA
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Extracting Text?

    Will this do what you need?

    =IF(LEFT(B3,5)="Stage",RIGHT(B3,1),"")

    That should work up to Stage 9. If the number goes to two digits, the formula could be changed to find the space and take the digits beyond it.


    Update - Looking at your spreadsheet again, I see the search for "Stage" needs to be more flexible. I'll give it more thought.
    Last edited by Canuck Chuck; 01-10-2012 at 01:37 PM. Reason: Determined solution was incomplete

  7. #7
    Registered User
    Join Date
    11-06-2011
    Location
    Massachusetts, USA
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Extracting Text?

    This should have the necessary flexibility:

    =IF(ISERROR(FIND("STAGE",B3)),"",MID(B3,FIND("STAGE",B3)+6,1))

  8. #8
    Valued Forum Contributor
    Join Date
    07-16-2007
    Location
    GA
    Posts
    292

    Re: Extracting Text?

    Hi Canuck Chuck,

    Thanks for the info.

    Is the following function case sensitive? My result is blank.

    This function seems to work well:

    =IF(ISERROR(FIND("STAGE",B3)),"",MID(B3,FIND("STAGE",B3)+6,1))
    MyCon

  9. #9
    Valued Forum Contributor
    Join Date
    07-16-2007
    Location
    GA
    Posts
    292

    Re: Extracting Text?

    Oops,

    I forgot to add in the function:
    =IF(LEFT(B3,5)="Stage",RIGHT(B3,1),"")

    Is this case sensitive?

    For this instance, it does not have or should be. However, with some other applications that I may have in mind, it may have to be for other projects that I'll be working later.

    Thanks
    MyCon

  10. #10
    Valued Forum Contributor
    Join Date
    07-16-2007
    Location
    GA
    Posts
    292

    Re: Extracting Text?

    Hi,

    I thought when I could get one of these functions working, I could modify to extract other data.

    Now, I'm trying to extract "HPT" & "LPT out of the column B.

    I thought I could use this:

    =IF(ISERROR(FIND("*HPT*",B3)),"HPT",--IF(ISERROR(FIND("*LPT*",B3)),"LPT"))

    It's finding "HPT", but not finding "LPT".

    What's missing to combine these functions?

    Thanks
    MyCon

  11. #11
    Registered User
    Join Date
    11-06-2011
    Location
    Massachusetts, USA
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Extracting Text?

    The Find command is case sensitive, so to make the formula work when the source isn't all caps, you can use this modification:

    =IF(ISERROR(FIND("STAGE",UPPER(B3))),"",MID(B3,FIND("STAGE",UPPER(B3))+6,1))

    The "Left" and "Right" commands are not case sensitive.

  12. #12
    Registered User
    Join Date
    11-06-2011
    Location
    Massachusetts, USA
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Extracting Text?

    Here is how I would write it:

    =IF(NOT(ISERROR(FIND("HPT",B3,1))),"HPT",IF(NOT(ISERROR(FIND("LPT",B3,1))),"LPT",""))

  13. #13
    Valued Forum Contributor Haseeb A's Avatar
    Join Date
    05-24-2011
    Location
    India | Kwt
    MS-Off Ver
    2007
    Posts
    1,453

    Re: Extracting Text?

    Another one...

    =LOOKUP(9E300,SEARCH({"?","HPT","LPT"},TEXT(B3,"@")),{"","HPT","LPT"})

    SEARCH is NOT case sensitive
    HTH; Haseeb

    If your problem is solved, please say so clearly, and mark your thread as Solved:
    Forum Rules & How to Mark a thread as SOLVED

  14. #14
    Valued Forum Contributor
    Join Date
    07-16-2007
    Location
    GA
    Posts
    292

    Re: Extracting Text?

    Hi Guys,

    Thanks again for the info. These few functions work great!

    That's all the questions I have at the moment....
    MyCon

+ 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.2.0