+ Reply to Thread
Results 1 to 10 of 10

Extract first character after every space

  1. #1
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    Extract first character after every space

    Hi,

    Me again

    I have a text string in cell B3 with a name and all I want to do is extract the first letter after every space with a formula but not the title.

    So for example:

    Mr Davy Jones should return as DJ

    I have the below formula that works to a point

    Please Login or Register  to view this content.
    But it doesn't work if I have a double barrel name such as Mr Davy Jones Smith and returns only DJ still and ideally it should return as DJS.

    Any ideas?

  2. #2
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Extract first character after every space

    I am little bit closer. If your name as : Mr.Davy Jones [Mr.start Name without space]
    A1 is : Mr.Davy Jones
    B1 :
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Extract first character after every space

    If we assume you're running 2010 per profile, another option might be to do something like the below:

    1. create a named range, with A1 active cell {assumed to be first description}:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    2. in B1, i.e. where you want to return value
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    if you need to increase from 5 letters change the ROW variable, and then add a further INDEX to the concatenation.

    if you're using XL2016 you can negate all of the above with CONCAT, e.g.;

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    all the while notwithstanding Atul's point, that you may need to handle a variety of titles / formats which may render the above flawed.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract first character after every space

    Try this one
    Enter formula in B1 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 Mr Davy Jones DJ
    2 Mis Mary Jones MJ
    3 Mr Andrew J Cort AJC
    Last edited by AlKey; 03-22-2019 at 09:38 AM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    Re: Extract first character after every space

    Hi Atul,

    Unfortunately there isn't a "." after the title and adding this to the report which has thousands of lines isn't something that I would like the end user to be doing.

    Also it is picking up the M for Mr so my result is returning MDJ for Mr Davy Jones and Mr Davy Jones Smith.

    Thanks for trying though

  6. #6
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    Re: Extract first character after every space

    Hi XLent,

    This would be far to complicated for the end users to complete hence why I just wanted a formula to give them so they can paste and copy down to the last row.

    I'm getting this strange feeling it cannot be done

    Thanks for the response though

  7. #7
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    Re: Extract first character after every space

    Hi AlKey,

    This appears to work

    Can you kindly explain how it is working or point me in the right direction?

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract first character after every space

    Hi Ratso,

    The formula I suggested is simply concatenation of few formulas joint with &.
    1. =MID(A1,FIND(" ",A1)+1,1)
    2. LEFT(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",50)),100,50)))
    3. LEFT(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",50)),150,50))

  9. #9
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    Re: Extract first character after every space

    Thanks Alkey,

    So if I am getting this correctly you are recreating the " " 50 times and then asking the formula to start from 100 characters in then 150 and so on and so forth?

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract first character after every space

    Quote Originally Posted by AlKey View Post
    Hi Ratso,

    The formula I suggested is simply concatenation of few formulas joint with &.
    1. =MID(A1,FIND(" ",A1)+1,1)
    2. LEFT(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",50)),100,50)))
    3. LEFT(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",50)),150,50))
    Yes, you are correct. For the forth one simply change the last formula:
    LEFT(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",50)),200,50))[/QUOTE]

+ 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. Replies: 3
    Last Post: 11-13-2018, 02:47 AM
  2. [SOLVED] Extract 2nd Character after space in string
    By sintek in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-08-2017, 08:12 AM
  3. Replies: 4
    Last Post: 11-08-2012, 10:26 PM
  4. [SOLVED] Insert two space after character
    By fatalcore in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-29-2012, 10:46 AM
  5. [SOLVED] Need to add space after every 4th Character
    By yus786 in forum Excel General
    Replies: 10
    Last Post: 04-04-2012, 06:08 AM
  6. Adding a space after a hex character
    By jaango123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-12-2011, 05:34 AM
  7. [SOLVED] How do I replace a BEL Character of 7 with a space
    By KBear in forum Excel General
    Replies: 1
    Last Post: 06-06-2006, 11:00 AM

Tags for this Thread

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