SYOUNG
asked on
Spllit Name Field
I need to split a single database field to LastName and FirstName. The single database field stores the name as "LastName; FirstName" (semicolon is the delimiter). I tried using the split function but it is not working for me. Normally I'd just create a view but this data is coming from a Pervasive database I am not familiar with.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Split function works great! The formula works too but I couldn't immediately figure out how to change the syntax for First Name. Thanks!
ASKER
Split function works great! The formula works too but I couldn't immediately figure out how to change the syntax for First Name. Thanks!
LastName --> LEFT( NameField , LOCATE(NameField, ';') -1 )
FirstName --> RIGHT( NameField, LENGTH(NameField) - LOCATE(NameField, ';') )
Note that the -1 on the LastName field means that if there is NO semicolon in the field, LOCATE returns 0, and a -1 gets passed to the LEFT function, which will likely spawn an error. You may have to do a conditional test for the presence of the semicolon before doing that function call.