Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Extract word after 3 spaces

Hi,
How can I extract a word from a cell when the word I want to extract is
always 2 spaces away starting counting spaces from the right.

Example:
Cell A1: Car, black 66,00 52,80
The word I want to extract is "Car, black"
Formula to be used in cell A2?
Or perhaps a macro?

Thank you in advance.

Kaj Pedersen

---
Denne e-mail blev kontrolleret for virusser af Avast antivirussoftware.
http://www.avast.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Extract word after 3 spaces

Hi,
How can I extract a word from a cell when the word I want to extract
is always 2 spaces away starting counting spaces from the right.

Example:
Cell A1: Car, black 66,00 52,80
The word I want to extract is "Car, black"
Formula to be used in cell A2?
Or perhaps a macro?

Thank you in advance.

Kaj Pedersen

---
Denne e-mail blev kontrolleret for virusser af Avast
antivirussoftware. http://www.avast.com


Perhaps a UDF...


Function ParseInstrRev2$(rng As Range)
Dim vTmp
vTmp = Split(rng, " ")
ParseInstrRev2 = vTmp(UBound(vTmp) - 2)
End Function

...and use as follows in the cell to receive the result...

=ParseInstrRev2(A1)

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Extract word after 3 spaces

Il giorno mercoledì 4 marzo 2015 22:24:57 UTC+1, ha scritto:
How can I extract a word from a cell when the word I want to extract is
always 2 spaces away starting counting spaces from the right.
Example:
Cell A1: Car, black 66,00 52,80
The word I want to extract is "Car, black"
Formula to be used in cell A2?
Or perhaps a macro?


Hi,
=LEFT(A1,FIND(" ",A1)-1)
-OR-
=LEFT(A1,FIND(CHAR(32)&CHAR(32),A1)-1)
--
Ciao!
Maurizio
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Extract word after 3 spaces

Ciao Maurizio,

Am Wed, 4 Mar 2015 23:22:32 -0800 (PST) schrieb Maurizio Borrelli:

=LEFT(A1,FIND(" ",A1)-1)


oh yes. I need new glasses. I did not realize the *2spaces*


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Extract word after 3 spaces

Il giorno giovedì 5 marzo 2015 08:33:04 UTC+1, Claus Busch ha scritto:
Am Wed, 4 Mar 2015 23:22:32 -0800 (PST) schrieb Maurizio Borrelli:
=LEFT(A1,FIND(" ",A1)-1)

oh yes. I need new glasses. I did not realize the *2spaces*


:-D
--
Ciao!
Maurizio
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Extract word after 3 spaces

Ciao Maurizio,

Am Wed, 4 Mar 2015 23:22:32 -0800 (PST) schrieb Maurizio Borrelli:

=LEFT(A1,FIND(" ",A1)-1)


oh yes. I need new glasses. I did not realize the *2spaces*


Regards
Claus B.


Now what if there really are 3 spaces as the topic title suggests...

car,black whitewalls 60.00 52.80

...where the correct result becomes "whitewalls" if persisting the
'always 2 spaces' criteria?

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Extract word after 3 spaces

Hi Garry,

Am Thu, 05 Mar 2015 03:15:32 -0500 schrieb GS:

Now what if there really are 3 spaces as the topic title suggests...


I guess the OP counts the spaces from left to right.

car,black whitewalls 60.00 52.80


car, black whitewalls 60.00 52.80

..where the correct result becomes "whitewalls" if persisting the
'always 2 spaces' criteria?


Find(" "; A1) finds two connected spaces and gives the correct result
if always are two spaces between the text and the numbers.


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Extract word after 3 spaces

Hi Garry,

Am Thu, 05 Mar 2015 03:15:32 -0500 schrieb GS:

Now what if there really are 3 spaces as the topic title suggests...


I guess the OP counts the spaces from left to right.

car,black whitewalls 60.00 52.80


car, black whitewalls 60.00 52.80

..where the correct result becomes "whitewalls" if persisting the
'always 2 spaces' criteria?


Find(" "; A1) finds two connected spaces and gives the correct
result if always are two spaces between the text and the numbers.


Regards
Claus B.


Wow! I totally missed the double space!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Extract word after 3 spaces

Il giorno giovedì 5 marzo 2015 09:15:43 UTC+1, GS ha scritto:
Am Wed, 4 Mar 2015 23:22:32 -0800 (PST) schrieb Maurizio Borrelli:
=LEFT(A1,FIND(" ",A1)-1)

oh yes. I need new glasses. I did not realize the *2spaces*

Now what if there really are 3 spaces as the topic title suggests...
car,black whitewalls 60.00 52.80
..where the correct result becomes "whitewalls" if persisting the
'always 2 spaces' criteria?


Hi.
Word(s?) after or before 3 spaces!?
Only OP can decide. :-)
=LEFT(A1,FIND(CHAR(32)&CHAR(32)&CHAR(32),A1)-1)
-OR-
=MID(A4,FIND(CHAR(32)&CHAR(32)&CHAR(32),A4)+3,LEN( A4))
--
Ciao!
Maurizio


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
extract text between two spaces anthony Excel Discussion (Misc queries) 5 April 21st 23 05:24 PM
Extract all text without spaces and special characters Alfredo_CPA Excel Worksheet Functions 4 September 18th 08 11:39 PM
how do I reduce the spaces between letters in a word? Spaces between letters Excel Discussion (Misc queries) 1 June 10th 08 05:50 PM
How to remove spaces from a word in a cell Jerry Excel Discussion (Misc queries) 5 January 15th 07 08:11 PM
how do i extract a number from a cell with no spaces? Mulvaney Excel Worksheet Functions 4 July 26th 05 09:15 PM


All times are GMT +1. The time now is 04:40 PM.

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

About Us

"It's about Microsoft Excel"