+ Reply to Thread
Results 1 to 7 of 7

Word Extraction Issues

  1. #1
    Registered User
    Join Date
    10-01-2012
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Word Extraction Issues

    Hi everyone,

    I'm having a few issues here with my if function, any help appreciated.

    My function is

    =IF(OR(E21="",E21="n/a"),G21, LEFT(E21, FIND("-", E21)-2))


    The function works great except when it encounters a word in cell E21 that has no hyphens ("-"). I tried to use the extract word before space as well but sometimes E21 has one word with a space.

    How would I write this function to call Cheer both from a cell that reads Cheer - AW222 and Cheer?

    Thank you in advance!

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Word Extraction Issues

    Perahps..

    =IF(OR(E21="",E21="n/a"),G21, IF(ISNUMBER(FIND("-", E21)),LEFT(E21, FIND("-", E21)-2),E21))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    10-01-2012
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Word Extraction Issues

    Thank you Ace!

    This solves my initial problem perfectly but for some reason its not returning G21 when the E21 cell is N/a or empty...

    What do you think? Maybe some sort of circular thing going on here?

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Word Extraction Issues

    The formula looks good to me..perhaps upload a sample workbook?

  5. #5
    Registered User
    Join Date
    10-01-2012
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Word Extraction Issues

    Fixed, thanks ACE!

    Just for learning sake can you explain what your isnumber function does?

    Thank you

  6. #6
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Word Extraction Issues

    The ISNUMBER function returns TRUE or FALSE depending on whether it finds a number or not.

    Hence, the ISNUMBER(FIND("-", E21)), basically checks whether "-" is found within E21 or not. If it finds a match it returns a number (the posiiton of "-" in the string) and ISNUMBER returns TRUE else FALSE.

    Trust this helps!

  7. #7
    Registered User
    Join Date
    10-01-2012
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Word Extraction Issues

    Wow Thank you jedi master

    Totally cleared up now, 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