Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Extracting Words from Cells

I would like to extract the last names from a group of cells
containing a first and last name and place them into a separate
column. Is there an easier way to accomplish this other than
highlghting the last name and using cut&paste to move into the new
cell?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Extracting Words from Cells

If each cell is only two names (first & last, no "Jr.", etc.) it's
pretty easy.

Dim c As Range
Dim rng As Range
Dim iPos As Integer
'change next line to suit
Set rng = Sheets("Sheet1").Range("A1:A10")
For Each c In rng
iPos = InStr(c, " ")
'extract last name and put in col B
c.Offset(0, 1) = Right(c, Len(c) - iPos)
Next c

Hth,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Extracting Words from Cells

If the first and last names are separated by a space and/or a comma, then
consider using Text to Columns
--
Gary''s Student
gsnu200706


"Tommy" wrote:

I would like to extract the last names from a group of cells
containing a first and last name and place them into a separate
column. Is there an easier way to accomplish this other than
highlghting the last name and using cut&paste to move into the new
cell?


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
Extracting cells from worksheet based on value of 2 cells nathanh Excel Worksheet Functions 1 March 19th 09 01:11 PM
Extracting parts of a cell when only certain words appear Craig860 Excel Discussion (Misc queries) 4 September 6th 08 07:35 AM
Extracting the last set of words from a text string IPerlovsky Excel Worksheet Functions 14 March 2nd 07 02:47 AM
Separating / extracting words within a cell Glen Excel Programming 5 August 29th 06 03:08 AM
Extracting just the color words Mariela Excel Worksheet Functions 5 January 20th 05 08:07 AM


All times are GMT +1. The time now is 01:53 AM.

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"