Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Trim a cell that has names and address to only show name

I have quite a few cells that have alot of information in them eg surname,
christian name and address. I only need the surname and christian name in one
cell. How can I do this?
eg Smith Jones 123 Harper St Manly (A1). I need the cell to only show Smith
Jones (B1)
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 222
Default Trim a cell that has names and address to only show name

Lengthy, but it always returns the second word from the string searched:

=MID(MID(MID(SUBSTITUTE(A1," ","^",1),1,256),
FIND("^",SUBSTITUTE(A1," ","^",1)),256),2,
FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",1),1,256),
FIND("^",SUBSTITUTE(A1," ","^",1)),256))-2)

Whichever word you want in the string, change the single digit in the
SUBSTITUTE to that number -1. So to get the 3rd word, change all the 1s to 2s.

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Christie" wrote:

I have quite a few cells that have alot of information in them eg surname,
christian name and address. I only need the surname and christian name in one
cell. How can I do this?
eg Smith Jones 123 Harper St Manly (A1). I need the cell to only show Smith
Jones (B1)

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 222
Default Trim a cell that has names and address to only show name

Just to be clear about changing it if you want to for other purposes, here is
the version that would always return the FOURTH word:

=MID(MID(MID(SUBSTITUTE(A1," ","^",3),1,256),
FIND("^",SUBSTITUTE(A1," ","^",3)),256),2,
FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",3),1,256),
FIND("^",SUBSTITUTE(A1," ","^",3)),256))-2)
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"JBeaucaire" wrote:

Lengthy, but it always returns the second word from the string searched:

=MID(MID(MID(SUBSTITUTE(A1," ","^",1),1,256),
FIND("^",SUBSTITUTE(A1," ","^",1)),256),2,
FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",1),1,256),
FIND("^",SUBSTITUTE(A1," ","^",1)),256))-2)

Whichever word you want in the string, change the single digit in the
SUBSTITUTE to that number -1. So to get the 3rd word, change all the 1s to 2s.

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Christie" wrote:

I have quite a few cells that have alot of information in them eg surname,
christian name and address. I only need the surname and christian name in one
cell. How can I do this?
eg Smith Jones 123 Harper St Manly (A1). I need the cell to only show Smith
Jones (B1)

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Trim a cell that has names and address to only show name

This works really well, thank you, however I need to also grab the first word
of the cell. I have tried 0 and -1 but that doesn't seem to work.
Can you help with this one?

"JBeaucaire" wrote:

Just to be clear about changing it if you want to for other purposes, here is
the version that would always return the FOURTH word:

=MID(MID(MID(SUBSTITUTE(A1," ","^",3),1,256),
FIND("^",SUBSTITUTE(A1," ","^",3)),256),2,
FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",3),1,256),
FIND("^",SUBSTITUTE(A1," ","^",3)),256))-2)
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"JBeaucaire" wrote:

Lengthy, but it always returns the second word from the string searched:

=MID(MID(MID(SUBSTITUTE(A1," ","^",1),1,256),
FIND("^",SUBSTITUTE(A1," ","^",1)),256),2,
FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",1),1,256),
FIND("^",SUBSTITUTE(A1," ","^",1)),256))-2)

Whichever word you want in the string, change the single digit in the
SUBSTITUTE to that number -1. So to get the 3rd word, change all the 1s to 2s.

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Christie" wrote:

I have quite a few cells that have alot of information in them eg surname,
christian name and address. I only need the surname and christian name in one
cell. How can I do this?
eg Smith Jones 123 Harper St Manly (A1). I need the cell to only show Smith
Jones (B1)

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Trim a cell that has names and address to only show name

Assuming the text after the full name *always* starts with a number (if it
doesn't, it will be nearly impossible to tell if the third "word" is part of
the name or is a street name without a number)...

=LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"012345 6789"))-2)

If there might be more than one space between the name and house number,
then use this instead..

=TRIM(LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0 123456789"))-1))

--
Rick (MVP - Excel)


"Christie" wrote in message
...
I have quite a few cells that have alot of information in them eg surname,
christian name and address. I only need the surname and christian name in
one
cell. How can I do this?
eg Smith Jones 123 Harper St Manly (A1). I need the cell to only show
Smith
Jones (B1)




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 222
Default Trim a cell that has names and address to only show name

First word is easy:

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

--
"Actually, I *am* a rocket scientist." -- JB
Your feedback is appreciated, click YES if this post helped you.


"Christie" wrote:

This works really well, thank you, however I need to also grab the first word
of the cell. I have tried 0 and -1 but that doesn't seem to work.
Can you help with this one?

"JBeaucaire" wrote:

Just to be clear about changing it if you want to for other purposes, here is
the version that would always return the FOURTH word:

=MID(MID(MID(SUBSTITUTE(A1," ","^",3),1,256),
FIND("^",SUBSTITUTE(A1," ","^",3)),256),2,
FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",3),1,256),
FIND("^",SUBSTITUTE(A1," ","^",3)),256))-2)
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Trim a cell that has names and address to only show name

I have two questions for you...

1) What if the person has 3 names? I have two examples of this from friends
of mine at work. The first is a woman whose legal first name is Mary Anne?
That coupled with her last name would give her 3 names on your list. The
second is a man whose last name if Della Rossa. That coupled with his first
name would give you 3 names on your list. How would you handle these cases
with the formulas JBeaucaire has given you?

2) Have you seen the formula I posted elsewhere in this thread?

--
Rick (MVP - Excel)


"Christie" wrote in message
...
This works really well, thank you, however I need to also grab the first
word
of the cell. I have tried 0 and -1 but that doesn't seem to work.
Can you help with this one?

"JBeaucaire" wrote:

Just to be clear about changing it if you want to for other purposes,
here is
the version that would always return the FOURTH word:

=MID(MID(MID(SUBSTITUTE(A1," ","^",3),1,256),
FIND("^",SUBSTITUTE(A1," ","^",3)),256),2,
FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",3),1,256),
FIND("^",SUBSTITUTE(A1," ","^",3)),256))-2)
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"JBeaucaire" wrote:

Lengthy, but it always returns the second word from the string
searched:

=MID(MID(MID(SUBSTITUTE(A1," ","^",1),1,256),
FIND("^",SUBSTITUTE(A1," ","^",1)),256),2,
FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",1),1,256),
FIND("^",SUBSTITUTE(A1," ","^",1)),256))-2)

Whichever word you want in the string, change the single digit in the
SUBSTITUTE to that number -1. So to get the 3rd word, change all the 1s
to 2s.

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Christie" wrote:

I have quite a few cells that have alot of information in them eg
surname,
christian name and address. I only need the surname and christian
name in one
cell. How can I do this?
eg Smith Jones 123 Harper St Manly (A1). I need the cell to only show
Smith
Jones (B1)


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Trim a cell that has names and address to only show name

Thank you
Now that I have grabbed the name and the address into seperate cells, I
neeed to see if they match the other spreadsheet. The name matches but now I
net to see if the address also matches the name.

"JBeaucaire" wrote:

First word is easy:

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

--
"Actually, I *am* a rocket scientist." -- JB
Your feedback is appreciated, click YES if this post helped you.


"Christie" wrote:

This works really well, thank you, however I need to also grab the first word
of the cell. I have tried 0 and -1 but that doesn't seem to work.
Can you help with this one?

"JBeaucaire" wrote:

Just to be clear about changing it if you want to for other purposes, here is
the version that would always return the FOURTH word:

=MID(MID(MID(SUBSTITUTE(A1," ","^",3),1,256),
FIND("^",SUBSTITUTE(A1," ","^",3)),256),2,
FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",3),1,256),
FIND("^",SUBSTITUTE(A1," ","^",3)),256))-2)
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Trim a cell that has names and address to only show name

Thank you now I need to match this and see if the address match the other
spreadsheet including the names aswell.
How do I do this?

"Rick Rothstein" wrote:

Assuming the text after the full name *always* starts with a number (if it
doesn't, it will be nearly impossible to tell if the third "word" is part of
the name or is a street name without a number)...

=LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"012345 6789"))-2)

If there might be more than one space between the name and house number,
then use this instead..

=TRIM(LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0 123456789"))-1))

--
Rick (MVP - Excel)


"Christie" wrote in message
...
I have quite a few cells that have alot of information in them eg surname,
christian name and address. I only need the surname and christian name in
one
cell. How can I do this?
eg Smith Jones 123 Harper St Manly (A1). I need the cell to only show
Smith
Jones (B1)



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 to create table of cell names with the name's cell address WildwoodEngr Excel Discussion (Misc queries) 1 October 26th 06 02:52 PM
How do I show the address of hyperlink to another cell in Excel ? Outlook写邮件遇到的问题 Excel Discussion (Misc queries) 1 June 7th 06 12:58 PM
address help (similar to trim or transpose) Aaaaa Excel Worksheet Functions 1 March 16th 06 03:18 PM
add email address to a list of names biochemist Excel Discussion (Misc queries) 5 May 17th 05 05:17 PM
HOW DO I ENTER TWO NAMES IN ONE ROW FOR ONE ADDRESS FOR LABELS sheilam Excel Discussion (Misc queries) 1 November 30th 04 03:12 PM


All times are GMT +1. The time now is 04:14 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"