Hi everyone!
I’m currently working on transforming name data in my dataset, and I'm encountering some challenges with my formulas. I need to rearrange names based on certain conditions while ensuring no data is lost or incorrectly formatted.
Context:
- I have three columns:
Vorname
,Nachname
, andWeitere Zugehörige Personen
. - The
Vorname
column may sometimes contain full names or just first names. - The
Nachname
column can also contain full names (with spaces) or proper last names. - The
Weitere Zugehörige Personen
column may be empty or contain names.
Requirements:
- If
Nachname
contains a full name (two words separated by a space) andWeitere Zugehörige Personen
is empty, I want to transfer theNachname
toWeitere Zugehörige Personen
. - If
Weitere Zugehörige Personen
already contains a name, I want to append theNachname
to it, separated by a comma. - If the
Nachname
column contains a last name, it should remain unchanged unless it meets the criteria above.
Current Issue:
I attempted the following formula in the Weitere Zugehörige Personen
column:
javascript
Code kopieren
if(
value.trim() == "",
if(
Nachname.trim().contains(" ") &&
!Vorname.trim().contains(Nachname.trim()),
if(
Weitere_Zugehörige_Personen.trim() == "",
Nachname.trim(),
Weitere_Zugehörige_Personen.trim() + ", " + Nachname.trim()
),
value
),
value
)
However, I encountered a parsing error, specifically "Parsing error at offset 60: Unknown function or control named".
Here is an example of what I am working with:
My previous transformations worked. The end result I want is that the first names are in Vorname, the last names are in Nachname, and the names of the other people are in Weitere Zugehörige Personen. i have tried multiple formulas and have not yet found a solution. Please advise!