Results 1 to 8 of 8

Extract word after specifying blank space

Threaded View

  1. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Extract word after specifying blank space

    case 1:
    Formula: copy to clipboard
    =IF(ISERROR(SEARCH(CHAR(127),SUBSTITUTE(A10," ",CHAR(127),4))),"",MID(A10,SEARCH(CHAR(127),SUBSTITUTE(A10," ",CHAR(127),2))+1,SEARCH(CHAR(127),SUBSTITUTE(A10," ",CHAR(127),3))-SEARCH(CHAR(127),SUBSTITUTE(A10," ",CHAR(127),2))))
    case 2:
    Formula: copy to clipboard
    =IF(ISERROR(SEARCH(CHAR(127),SUBSTITUTE(A15," ",CHAR(127),8))),"",MID(A15,SEARCH(CHAR(127),SUBSTITUTE(A15," ",CHAR(127),4))+1,SEARCH(CHAR(127),SUBSTITUTE(A15," ",CHAR(127),5))-SEARCH(CHAR(127),SUBSTITUTE(A15," ",CHAR(127),4))))


    change A10 and A15 suitable.

    Edit:
    Formula checking spaces from left to right.
    Logical test is changed to LEN(A1)-LEN(SUBSTITUTE(A1," ",""))=4 or 8
    MID(...) can be defined as NAME (e.g. ShortString and LongString) in Name Manager, so formula will be shorter and clear
    Maybe someone else will give you shorter solution

    formula for both cases:
    Formula: copy to clipboard
    =IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))=4,MID(A1,SEARCH(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),2))+1,SEARCH(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),3))-SEARCH(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),2))),IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))=8,MID(A1,SEARCH(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),4))+1,SEARCH(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),5))-SEARCH(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),4))),""))
    Last edited by sandy666; 02-25-2016 at 08:53 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extract first word and last numbers after space
    By ammartino44 in forum Excel General
    Replies: 10
    Last Post: 07-29-2015, 01:48 PM
  2. Is there a word macro to help me (1) combine different word files and (2) add space?
    By studyboymark in forum Word Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2015, 03:19 AM
  3. Extract text between # and space
    By bp2010 in forum Excel General
    Replies: 3
    Last Post: 12-21-2010, 07:48 PM
  4. Extract text with space
    By maxthebear in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-01-2009, 08:01 PM
  5. Replies: 13
    Last Post: 05-06-2009, 07:33 AM
  6. Replies: 2
    Last Post: 06-22-2005, 08:05 PM
  7. [SOLVED] How do I clear blank space at the top of a word-wrapped text cell?
    By mirage1210 in forum Excel General
    Replies: 2
    Last Post: 02-11-2005, 06: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