Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Dec 18, 2022 02:36 AM
Hey friends
I have a column of customer full names.
I would like to separate this column into 2 separate columns - one for first names and the other for last names.
I used the following formula (screenshot attached) to separate the first and last names, but there is a problem:
If someone entered only their first name without a last name, the column remains empty and I don't understand why.
I would be very happy for your help in this matter!
Thank you
Solved! Go to Solution.
Dec 18, 2022 04:52 AM
Dec 18, 2022 04:52 AM
Dec 18, 2022 11:09 AM
If someone entered only their first name without a last name, the column remains empty and I don't understand why.
This is because the FIND() function returns zero if it doesn't find a space, which is the case when there is only a first name. And zero minus one is negative one. SO the LEFT() function returns negative one characters, which is no characters.
There are many possible functions to extract the first name. Another possible function would be
REGEX_REPLACE({Full name}, " .*", "")
This formula replaces the first space and any following characters with an empty string, leaving only the first name.
Another thing to consider is to see if you can get the source of the data to enter the first name and last name separately. Having data entry correctly to begin with saves a lot of work in cleaning the data later. When you end up with people typing in middle names, having multi-word last names, or suffixes, cleaning up names gets tricky.