Jump to content
  • 0

Split a string up from one column to 2 columns (First Name, Last Name)


Josh1425

Question

7 answers to this question

Recommended Posts

  • 0

Hi @Josh1425,

You can use this Formula to get the first name:

left([@field:Name], charindex(' ', [@field:Name])-1)

This on the last name:

right([@field:Name], (len([@field:Name])-charindex(' ', [@field:Name])))

 

Only problem I see here is if the User has Second name, the formula will just get the first part split by the space. And then the Last name will be considered all the string after the first name.

I hope this helps.

Glitch();

Link to comment
Share on other sites

  • 0

I think its always better to have it the other way around. Like let your users type their first name and last name separately. Reason being, it would be complicated to do this workflow if you have multiple word first name.

For example:

John Michael Doe

The result will be 

First name = John
Last name= Michael Doe

Which is incorrect. And yes, you can use CASE WHEN but then again, it will complicate things because you'll need to look for how many spaces are there.

So my suggestion is to do this the other way around, type the first and last name separately. Then, concatenate it using a formula/hidden calc value for the full name.

Just sharing my two cents ;)

Link to comment
Share on other sites

  • 0
7 hours ago, Tubby said:

I think its always better to have it the other way around. Like let your users type their first name and last name separately. Reason being, it would be complicated to do this workflow if you have multiple word first name.

For example:

John Michael Doe

The result will be 

First name = John
Last name= Michael Doe

Which is incorrect. And yes, you can use CASE WHEN but then again, it will complicate things because you'll need to look for how many spaces are there.

So my suggestion is to do this the other way around, type the first and last name separately. Then, concatenate it using a formula/hidden calc value for the full name.

Just sharing my two cents ;)

definitely agree with @Tubby :) 

[@field:FirstName]+ ' ' +[@field:LastName]

Here's a sample of what we can use to concatenate fields so we form a whole name.

https://howto.caspio.com/function-reference/

Link to comment
Share on other sites

  • 0

Hello! Just to update this post, to move the first and last name to their own column from the name field, you can use this formula as well. 

for first name: SUBSTRING([@field:name],0, CHARINDEX(' ',[@field:name]))

for last name; RIGHT([@field:name], LEN([@field:name]) - PATINDEX('% %', [@field:name]))

Hope this helps! :) ;)

Link to comment
Share on other sites

  • 0

Hi! Just to add to this post if the format is like this "Chris Dolls & Pat Doe" and you need to get only the first names of both full names, you can apply this formula.

"left([@field:FamilyName], charindex(' ', [@field:FamilyName])-1) +' & '+ left(right([@field:FamilyName], (len([@field:FamilyName])-charindex('&', [@field:FamilyName]))), charindex(' ', [@field:FamilyName])-1)"

Sample Result:

 

 

image.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...