Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Extracting names and titles

Sub test()
Dim i As Long
Dim s As String
Dim sArr() As String
s = "Dr. med. Betty Eastwood"
sArr = Split(s, " ")
If UBound(sArr) = 0 Then
For i = 0 To UBound(sArr)
Debug.Print sArr(i)
Next
End If
End Sub

Regards,
Peter T

"andreashermle" wrote in message
...
Dear Experts:

I got a client list (German names) where the whole name including
title is in just one cell, such as

Dr. med. Betty Eastwood
Prof. Dr. Dr. Joe Doe
Dr. John Westwood
Dr. phil. Robert Friedman

I know how to extract the first occurrence of a word and the last one,
i.e. in the first example "Dr." and "Eastwood". But how to extract the
ones that are in between (one to three occurrences).

Help is much appreciated. Thank you very much in advance.

Regards, Andreas



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Extracting names and titles

On Nov 26, 6:24*pm, "Peter T" <peter_t@discussions wrote:
Sub test()
Dim i As Long
Dim s As String
Dim sArr() As String
* * s = "Dr. med. Betty Eastwood"
* * sArr = Split(s, " ")
* * If UBound(sArr) = 0 Then
* * * * For i = 0 To UBound(sArr)
* * * * * * Debug.Print sArr(i)
* * * * Next
* * End If
End Sub

Regards,
Peter T

"andreashermle" wrote in message

...



Dear Experts:


I got a client list (German names) where the whole name including
title is in just one cell, such as


Dr. med. Betty Eastwood
Prof. Dr. Dr. Joe Doe
Dr. John Westwood
Dr. phil. Robert Friedman


I know how to extract the first occurrence of a word and the last one,
i.e. in the first example "Dr." and "Eastwood". But how to extract the
ones that are in between (one to three occurrences).


Help is much appreciated. Thank you very much in advance.


Regards, Andreas- Hide quoted text -


- Show quoted text -


Hi Peter,

thank you very much for your swift answer. I am afraid to tell you
that the macro is not working. Any idea why.

Regards, Andreas
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Extracting names and titles


"andreashermle" wrote in message
...
On Nov 26, 6:24 pm, "Peter T" <peter_t@discussions wrote:
Sub test()
Dim i As Long
Dim s As String
Dim sArr() As String
s = "Dr. med. Betty Eastwood"
sArr = Split(s, " ")
If UBound(sArr) = 0 Then
For i = 0 To UBound(sArr)
Debug.Print sArr(i)
Next
End If
End Sub

Regards,
Peter T

"andreashermle" wrote in message

...



Dear Experts:


I got a client list (German names) where the whole name including
title is in just one cell, such as


Dr. med. Betty Eastwood
Prof. Dr. Dr. Joe Doe
Dr. John Westwood
Dr. phil. Robert Friedman


I know how to extract the first occurrence of a word and the last one,
i.e. in the first example "Dr." and "Eastwood". But how to extract the
ones that are in between (one to three occurrences).


Help is much appreciated. Thank you very much in advance.


Regards, Andreas- Hide quoted text -


- Show quoted text -


Hi Peter,

thank you very much for your swift answer. I am afraid to tell you
that the macro is not working. Any idea why.

Regards, Andreas

================================================

What does not working mean? Eg it does not return anything in the Immediate
window, gives wrong results, it breaks on an error, etc

Regards,
Peter T



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Extracting names and titles

On Nov 26, 11:23*pm, "Peter T" <peter_t@discussions wrote:
"andreashermle" wrote in message

...
On Nov 26, 6:24 pm, "Peter T" <peter_t@discussions wrote:





Sub test()
Dim i As Long
Dim s As String
Dim sArr() As String
s = "Dr. med. Betty Eastwood"
sArr = Split(s, " ")
If UBound(sArr) = 0 Then
For i = 0 To UBound(sArr)
Debug.Print sArr(i)
Next
End If
End Sub


Regards,
Peter T


"andreashermle" wrote in message


....


Dear Experts:


I got a client list (German names) where the whole name including
title is in just one cell, such as


Dr. med. Betty Eastwood
Prof. Dr. Dr. Joe Doe
Dr. John Westwood
Dr. phil. Robert Friedman


I know how to extract the first occurrence of a word and the last one,
i.e. in the first example "Dr." and "Eastwood". But how to extract the
ones that are in between (one to three occurrences).


Help is much appreciated. Thank you very much in advance.


Regards, Andreas- Hide quoted text -


- Show quoted text -


Hi Peter,

thank you very much for your swift answer. I am afraid to tell you
that the macro is not working. Any idea why.

Regards, Andreas

================================================

What does not working mean? Eg it does not return anything in the Immediate
window, gives wrong results, it breaks on an error, etc

Regards,
Peter T- Hide quoted text -

- Show quoted text -


Dear Peter,

I got it running now. Great job! Thank you very much for your
professional help. Regards, Andreas
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
combine titles/names - how? Martin ©¿©¬ @nohere.net Excel Discussion (Misc queries) 7 March 22nd 10 01:47 PM
Column Titles/Names fishkner Setting up and Configuration of Excel 1 January 13th 08 04:16 PM
extracting names CJ Excel Discussion (Misc queries) 10 January 11th 07 05:28 AM
Extracting names and suffixes Rookie_User Excel Discussion (Misc queries) 2 September 18th 06 05:53 PM
Extracting tab names MLK Excel Worksheet Functions 5 July 19th 06 08:52 PM


All times are GMT +1. The time now is 07:00 AM.

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"