Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 275
Default extract text between two spaces

how do i use the mid function to extract the "word" between the second and
third spaces or between the fourth and fifth spaces or even between the
second and fourth spaces?

thanks in advance
  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: extract text between two spaces

Hi there! To extract text between two spaces using the MID function in Excel, you can follow these steps:
  1. Determine the position of the spaces: To extract the "word" between the second and third spaces, you need to know the position of the second and third spaces. You can use the FIND function to locate the positions of the spaces. For example, to find the position of the second space in cell A1, you can use the formula:
    Formula:
    =FIND(" ",A1,FIND(" ",A1)+1
  2. Use the MID function: Once you know the positions of the spaces, you can use the MID function to extract the text between them. The syntax of the MID function is: =MID(text, start_num, num_chars). In this case, the "text" argument is the cell containing the text you want to extract from, the "start_num" argument is the position of the second space plus 1 (to start extracting after the second space), and the "num_chars" argument is the difference between the positions of the third space and the second space (to extract the text between them). The formula would look like this:
    Formula:
    =MID(A1,FIND(" ",A1,FIND(" ",A1)+1)+1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1)+1))-FIND(" ",A1,FIND(" ",A1)+1)) 
  3. Repeat for other positions: To extract the "word" between the fourth and fifth spaces or between the second and fourth spaces, you can follow the same steps, but adjust the positions of the spaces in the formulas accordingly.
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default extract text between two spaces

=SUBSTITUTE(A1," word","")

extracts it from anywhere. Does it suit your needs?

Regards,
Stefi


€˛anthony€¯ ezt Ć*rta:

how do i use the mid function to extract the "word" between the second and
third spaces or between the fourth and fifth spaces or even between the
second and fourth spaces?

thanks in advance

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default extract text between two spaces

On Mon, 19 Feb 2007 22:19:21 -0800, anthony
wrote:

how do i use the mid function to extract the "word" between the second and
third spaces or between the fourth and fifth spaces or even between the
second and fourth spaces?

thanks in advance


I would use a different method (regular expressions), but to use the MID
function, where SpaceNum1 is the number of the first space (e.g. 2 for second),
and SpaceNum2 is the number of the second space, you can use:

=MID(A1,FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),
SpaceNum1))+1,FIND(CHAR(1),SUBSTITUTE(A1," ",
CHAR(1),SpaceNum2))-FIND(CHAR(1),SUBSTITUTE(
A1," ",CHAR(1),SpaceNum1))-1)


--ron
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 275
Default extract text between two spaces


thanks ron works perfect
(and i was able to modify it slightly)


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default extract text between two spaces

On Tue, 20 Feb 2007 04:26:05 -0800, anthony
wrote:


thanks ron works perfect
(and i was able to modify it slightly)



Glad to help. Thanks for the feedback
--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I remove all spaces in a text string dn Excel Discussion (Misc queries) 3 April 2nd 23 07:20 PM
How do I delete spaces from the end of text George Excel Discussion (Misc queries) 4 September 11th 06 07:33 AM
how to erase all spaces in text cell? D Excel Worksheet Functions 3 May 23rd 06 08:41 AM
how do i extract a number from a cell with no spaces? Mulvaney Excel Worksheet Functions 4 July 26th 05 09:15 PM
Cells and and spaces after a string of text H Excel Worksheet Functions 2 November 19th 04 09:26 PM


All times are GMT +1. The time now is 12:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"