Substring before and after a comma (1 Viewer)

JH40

Registered User.
Local time
Today, 06:46
Joined
Sep 16, 2010
Messages
100
I'm trying to separate first and last name in a column into two columns. Seems like there should be a simple query expression for this. Does anyone know what that would be? The field is currently formatted as:

Doe, John (one column)

Need "Doe" in column 1 and "John" in column 2.

Thank you...
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 14:46
Joined
Sep 12, 2006
Messages
15,660
you want the split function, which will divide the text into an array, based on whatever "split" you choose - in this case, a comma

then you can use the array.
 

jdraw

Super Moderator
Staff member
Local time
Today, 09:46
Joined
Jan 23, 2006
Messages
15,385
Another approach

x = "Doe, John"
column1 = Mid(x, 1, InStr(x, ",") - 1)
column2 = Mid(x, InStrRev(x, ",") + 2)
 

Users who are viewing this thread

Top Bottom