View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
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