Search code examples
excelexcel-formuladelimiterseparator

Delimit Excel in different formats in one action


I would like to ask if this is possible. In 1 cell there is a data for names. e.g. "Dela Cruz, Juan" and "Juan Dela Cruz". I would like to separate them in cell that has a tag of first name in full name.

enter image description here


Solution

  • I believe this is what you would like to achieve:
    different delimiters

    Formula in B2:

    =IF(LEN(A2)-LEN(SUBSTITUTE(A2,",",""))>0,
         TRIM(RIGHT(A2,LEN(A2)-FIND(",",A2))),
         TRIM(LEFT(A2,FIND(" ",A2)-1)))
    

    Formula in C2:

    =IF(LEN(A2)-LEN(SUBSTITUTE(A2,",",""))>0,
         TRIM(LEFT(A2,(FIND(",",A2)-1))),
         TRIM(RIGHT(A2,LEN(A2)-FIND(" ",A2))))