Hello,
I've imported an excel spreadsheet with a Name column which is
formatted as Last, First, MI. Some examples I have in the Name column:
Smith, Ellen P.
Jones, Mary Jane
Blackman-Pearson, Betsy D.
Wright, George
I need to parse it out so I have two columns, LastName and FirstName
with No Middle initial and No Middle Name. It's ok for hyphenated last
names to remain so.
I've successfully parsed the last name in a query with the following
statement:
Last: Left([Name],InStr([Name],",")-1) which produced the following:
Smith
Jones
Blackman-Pearson
Wright
So far so good.
I've parsed out everything following the comma to begin my attempt at
just grabbing the first name. I've used the following code:
First: Trim(Mid([Name],InStr([Name],",")+1)) which produced the
following:
Ellen P.
Mary Jane
Betsy D.
George
As you can see, it only works when there is one first name with no
initial. I'm stuck on how to parse out just the first name with
nothing else. This is what I evenutally want to see:
Ellen
Mary
Betsy
George
Any help is greatly appreciated.
Thanks
WPW 4 1814
use right(first,1) = "." to identify those with initials
and then use another inStr() function to get just the first name
william wrote:
Hello,
I've imported an excel spreadsheet with a Name column which is
formatted as Last, First, MI. Some examples I have in the Name column:
Smith, Ellen P.
Jones, Mary Jane
Blackman-Pearson, Betsy D.
Wright, George
I need to parse it out so I have two columns, LastName and FirstName
with No Middle initial and No Middle Name. It's ok for hyphenated last
names to remain so.
I've successfully parsed the last name in a query with the following
statement:
Last: Left([Name],InStr([Name],",")-1) which produced the following:
Smith
Jones
Blackman-Pearson
Wright
So far so good.
I've parsed out everything following the comma to begin my attempt at
just grabbing the first name. I've used the following code:
First: Trim(Mid([Name],InStr([Name],",")+1)) which produced the
following:
Ellen P.
Mary Jane
Betsy D.
George
As you can see, it only works when there is one first name with no
initial. I'm stuck on how to parse out just the first name with
nothing else. This is what I evenutally want to see:
Ellen
Mary
Betsy
George
Any help is greatly appreciated.
Thanks
WPW
Thank you. That definitely identifies those with initials, but what
about those with the first and middle name written out (e.g. Mary
Jane)?
William
On Nov 4, 9:42 am, lesperan...@nat pro.com wrote:
use right(first,1) = "." to identify those with initials
and then use another inStr() function to get just the first name
william wrote:
Hello,
I've imported an excel spreadsheet with a Name column which is
formatted as Last, First, MI. Some examples I have in the Name column:
Smith, Ellen P.
Jones, Mary Jane
Blackman-Pearson, Betsy D.
Wright, George
I need to parse it out so I have two columns, LastName and FirstName
with No Middle initial and No Middle Name. It's ok for hyphenated last
names to remain so.
I've successfully parsed the last name in a query with the following
statement:
Last: Left([Name],InStr([Name],",")-1) which produced the following:
Smith
Jones
Blackman-Pearson
Wright
So far so good.
I've parsed out everything following the comma to begin my attempt at
just grabbing the first name. I've used the following code:
First: Trim(Mid([Name],InStr([Name],",")+1)) which produced the
following:
Ellen P.
Mary Jane
Betsy D.
George
As you can see, it only works when there is one first name with no
initial. I'm stuck on how to parse out just the first name with
nothing else. This is what I evenutally want to see:
Ellen
Mary
Betsy
George
Any help is greatly appreciated.
Thanks
WPW
On 4 Nov 2006 05:34:40 -0800, william wrote:
Hello,
I've imported an excel spreadsheet with a Name column which is
formatted as Last, First, MI. Some examples I have in the Name column:
Smith, Ellen P.
Jones, Mary Jane
Blackman-Pearson, Betsy D.
Wright, George
I need to parse it out so I have two columns, LastName and FirstName
with No Middle initial and No Middle Name. It's ok for hyphenated last
names to remain so.
I've successfully parsed the last name in a query with the following
statement:
Last: Left([Name],InStr([Name],",")-1) which produced the following:
Smith
Jones
Blackman-Pearson
Wright
So far so good.
I've parsed out everything following the comma to begin my attempt at
just grabbing the first name. I've used the following code:
First: Trim(Mid([Name],InStr([Name],",")+1)) which produced the
following:
Ellen P.
Mary Jane
Betsy D.
George
As you can see, it only works when there is one first name with no
initial. I'm stuck on how to parse out just the first name with
nothing else. This is what I evenutally want to see:
Ellen
Mary
Betsy
George
Any help is greatly appreciated.
Thanks
WPW
Two things for you to consider.
1) Your first sentence formatted as Last, First, MI. < indicates
commas separating each of the names, but your examples
Smith, Ellen P.
Jones, Mary Jane
Blackman-Pearson, Betsy D.
Wright, George
show commas only after the Last Name, and a space separating the First
and middle names/initials.
Which is it, a comma or a space?
Paste the below code into a Module:
Public Function ParseMixed(Text In As String, SplitChar As String, x)
As Variant
On Error Resume Next
Dim Var As Variant
Var = Split(TextIn, SplitChar, -1)
ParseMixed = Var(x)
End Function
=============== ===
In a query to separate the LastName:
LastName:ParseM ixed([CombinedNames],",",0)
Then if the first names or initials are separated by a comma, i.e.
Smith, Ellen, P in a query:
FirstName:Exp: ParseMixed([CombinedNames],",",1)
However if the FirstNames are separated from each other by a space,
i.e. Smith, Ellen P. then use:
FirstName:Exp: ParseMixed([CombinedNames]," ",1)
2) Name is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:
109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Thanks Fred and sorry about the confusion. The latter was correct. A
comma appears only after the Last Name, and a space separates the First
and middle names/initials.
Your solution worked perfectly.
Thank you for your help.
William
fredg wrote:
On 4 Nov 2006 05:34:40 -0800, william wrote:
Hello,
I've imported an excel spreadsheet with a Name column which is
formatted as Last, First, MI. Some examples I have in the Name column:
Smith, Ellen P.
Jones, Mary Jane
Blackman-Pearson, Betsy D.
Wright, George
I need to parse it out so I have two columns, LastName and FirstName
with No Middle initial and No Middle Name. It's ok for hyphenated last
names to remain so.
I've successfully parsed the last name in a query with the following
statement:
Last: Left([Name],InStr([Name],",")-1) which produced the following:
Smith
Jones
Blackman-Pearson
Wright
So far so good.
I've parsed out everything following the comma to begin my attempt at
just grabbing the first name. I've used the following code:
First: Trim(Mid([Name],InStr([Name],",")+1)) which produced the
following:
Ellen P.
Mary Jane
Betsy D.
George
As you can see, it only works when there is one first name with no
initial. I'm stuck on how to parse out just the first name with
nothing else. This is what I evenutally want to see:
Ellen
Mary
Betsy
George
Any help is greatly appreciated.
Thanks
WPW
Two things for you to consider.
1) Your first sentence formatted as Last, First, MI. < indicates
commas separating each of the names, but your examples
Smith, Ellen P.
Jones, Mary Jane
Blackman-Pearson, Betsy D.
Wright, George
show commas only after the Last Name, and a space separating the First
and middle names/initials.
Which is it, a comma or a space?
Paste the below code into a Module:
Public Function ParseMixed(Text In As String, SplitChar As String, x)
As Variant
On Error Resume Next
Dim Var As Variant
Var = Split(TextIn, SplitChar, -1)
ParseMixed = Var(x)
End Function
=============== ===
In a query to separate the LastName:
LastName:ParseM ixed([CombinedNames],",",0)
Then if the first names or initials are separated by a comma, i.e.
Smith, Ellen, P in a query:
FirstName:Exp: ParseMixed([CombinedNames],",",1)
However if the FirstNames are separated from each other by a space,
i.e. Smith, Ellen P. then use:
FirstName:Exp: ParseMixed([CombinedNames]," ",1)
2) Name is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:
109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rutger Claes |
last post by:
I'm trying to make sort of a simple template system using XML.
Imagine the following xml code:
<page>
<header>...</header>
<body>
<title>My News</title>
<?news to_list 10?>
</body>
</page>
|
by: Michael Hogan |
last post by:
I want to pars a playlist file for three different varibles, so I can save
them as mp3 files. I am using:
strTEMPURL = GetUrlSource(Text1.Text)
to put the entire .pls file into a strTEMPURL varible.
I want to grab .pls files from shoutcast and break them into varibles.
----------------Begin winamp.pls file-------------------
|
by: Joey Martin |
last post by:
Couple questions when parsing using replace.
I have the following text I am parsing:
$650
Number of Bedrooms 3
Air Conditioning? Yes
Original Ad SOUTH, 3BR, air, basement. $650. Call 278-4171.
First Appeared in the Newspaper
Thursday, October 30, 2003
$775
|
by: Vegard Beider |
last post by:
Hi.
I am new to both C# and XML parsing. I simply want to find out if a
node contains other nodes, and if it does i want to do something with
it. How can i find out in a simple way that in the example below both
<data> and <moredata> contains other nodes? I have been using both the
XPathNavigator and the XMLNodeReader without finding a cleaver way of
doing this...
XML example:
|
by: Tuomas Rannikko |
last post by:
Hello,
I'm currently writing a XML processor for the fun of it. There is
something I don't understand in the spec though. I'm obviously missing
something important.
The spec states that both Internal General and Character references are
included when referenced in content. And "included" means:
<quote>
| |
by: sbowman |
last post by:
I have a completely lame string parsing question, but I need an answer
fast and I know this is where to get it...I'm not completely familiar
with the Len, Right, Left, and mid functions and I have a field that
looks like Last, First M. I need to parse it out into three
fields...help??
Thanks!
Shelley
|
by: igotyourdotnet |
last post by:
I have a question.
I'm reading a CSV file that is uploading to my SQL db, I'm parsing out the
file line by line. I'm getting the values and putting them into an arrayList
seperate by commas. The problem I'm having is that one of the data values has
commas in it so its blowing up on the other fields. How can I remove the
commas from my string if they exist?
example:
Getting this
BMW, Used, 325C, $19,252.00, Smith
|
by: Bryan |
last post by:
If I have the following string from a huge xml file:
std::string s = "<input key1=\"v1\" key2=\"val4\" key3=\"test\" />";
I need to get the values associated with the keys out from this line.
What is the best way to do this? I was looking at sscanf, and
std::string find, but this seems kind of brute force to find the key,
get the pos, increment by 2 (for the = and first ") then grab everything
up to the next ". But maybe this is the...
|
by: cjl |
last post by:
As a learning exercise, I am trying to write a web-based version of
'drawbot' in PHP.
See: http://just.letterror.com/ltrwiki/DrawBot
I am interested in hearing ideas about how to approach the user input
parsing problem. I would like to allow people to type in simple code
and have it executed, but I need to limit the code they can write to a
few pre-defined drawing functions, as well as control structures like
loops, if thens, etc...
|
by: i_robot73 |
last post by:
I have a file, containing hex values for dates (MMDDYYYY)<status
code><??such as:
303530313230303102003035303232303031020030353033323030310200303530343230303102003035303732303031020030353038323030310200
breaking that down:
30353031323030310200
30353032323030310200
30353033323030310200
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |