+ Reply to Thread
Results 1 to 7 of 7

Formula to return characters after a letter and before the first space

  1. #1
    Registered User
    Join Date
    03-14-2014
    Location
    Vancouver
    MS-Off Ver
    Excel 2013
    Posts
    5

    Formula to return characters after a letter and before the first space

    Hi everyone,

    I am close to achieving my goal, I have two formulas in separate cells which give me the desired values, but I would like this all to be performed in one cell.

    The first formula is in cell E2: =IF(ISNUMBER(SEARCH("x",A2)),RIGHT(A2,LEN(A2)-FIND("x",A2))," "). A2 contains a string of text such as: EE - Roof Sloped - SF x2 buildings.

    The second one is in cell F2: =IFERROR(LEFT(E2,FIND(" ",E2)),E2)

    I would like these two formulas to work within cell E2. The objective is to have a formula to search the string of text and return the number that follows the "x" and before the next space. All the help is much appreciated. I would like to avoid VBA, although I don't believe it is needed in this case.

    Thank you!

  2. #2
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,373

    Re: Formula to return characters after a letter and before the first space

    ANd you need to combine formula for Cell E2? Am I right?

  3. #3
    Registered User
    Join Date
    03-14-2014
    Location
    Vancouver
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Formula to return characters after a letter and before the first space

    Yes, I would like these two formulas combined in cell E2

  4. #4
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,373

    Re: Formula to return characters after a letter and before the first space

    Maybe:

    =IFERROR(LEFT(E2,FIND(" ",E2)),E2)&" "&IF(ISNUMBER(SEARCH("x",E2)),RIGHT(E2,LEN(E2)-FIND("x",E2))," ")

  5. #5
    Registered User
    Join Date
    03-14-2014
    Location
    Vancouver
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Formula to return characters after a letter and before the first space

    Unfortunately, this returned EE.

    The idea is that in the text string "EE - Roof Sloped - SF x2 buildings", which is in cell A2, I want the formula (in cell E2) to return the number after the "x" but before the next space. In this case, 2.

    Thank you for the suggestion tho.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Formula to return characters after a letter and before the first space

    How many digits might there be after the "x"? This will extract up to 3

    =LOOKUP(1000,MID(E2,FIND("x",E2)+1,{1,2,3})+0)
    Audere est facere

  7. #7
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,373

    Re: Formula to return characters after a letter and before the first space

    =IFERROR(LEFT(IF(ISNUMBER(SEARCH("x",A2)),RIGHT(A2,LEN(A2)-FIND("x",A2))," "),FIND(" ",E2)),E2)

    Sorry for my mistake

    Just put your first formula:
    IF(ISNUMBER(SEARCH("x",A2)),RIGHT(A2,LEN(A2)-FIND("x",A2))," ")

    into part with red color:
    =IFERROR(LEFT(E2,FIND(" ",E2)),E2)

    and you'll find the number....
    Last edited by azumi; 03-14-2014 at 07:19 PM.

+ 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. [SOLVED] Return cell characters before space
    By jocer in forum Excel General
    Replies: 3
    Last Post: 08-08-2012, 12:56 AM
  2. Putting a space before a letter, after a number
    By Monkey106 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-01-2010, 06:33 PM
  3. Return Characters from Formula
    By jrmfzf in forum Excel General
    Replies: 2
    Last Post: 12-09-2009, 12:35 PM
  4. space between evey letter
    By james.halliwell in forum Excel General
    Replies: 1
    Last Post: 04-03-2009, 08:10 AM
  5. Replies: 2
    Last Post: 05-09-2005, 04:06 PM

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