如何将字符串从“lastName, firstName”切换到“firstName, lastName”?

时间:2023-01-14 16:24:08

I have a column full of names written as:

我有一栏写满了名字:

"lastName, firstName"

“名,姓”

I want to have a nother column that has this name list written as:

我想有另外一个列,把这个名单写为:

"firstName LastName"

“firstName LastName”

So, how can I switch a string from "lastName, firstName" to "firstName LastName" ?

那么,如何将字符串从“lastName, firstName”切换到“firstName, lastName”?

4 个解决方案

#1


14  

If the first name is in A2 try this formula in B2 copied down

如果第一个名字在A2中,试试这个公式在B2中复制下来

=MID(A2&" "&A2,FIND(" ",A2)+1,LEN(A2)-1)

=中期(A2”“&A2,找到“A2 + 1,LEN(A2)1)

#2


1  

Enter data into cells e.g.

向单元格中输入数据。

Brown, John
Green, Bob
Smith, Will

(Note that the comma in this case is the delimiter which the system will use to separate the entries) Highlight these cells.
Click on the "Data" tab, click on "Text to Column".
Choose options offered.

(注意,在本例中,逗号是分隔符,系统将使用它来分隔条目)突出显示这些单元格。点击“Data”选项卡,点击“Text to Column”。选择选项提供。

#3


0  

The worked for me =RIGHT(C3,LEN(C3)-LEN(LEFT(C3,FIND(",",C3)-1))-1) & " " & LEFT(C3,FIND(",",C3)-1)

为我工作=右(C3,LEN(C3)兰(左(C3,发现(”、“C3)1))1)& " " &左(C3,发现(”、“C3)1)

#4


-3  

The above answer is incorrect. In fact, for my own name, Jay Jacob Wind, the formula breaks. The correct formula is:

上面的答案是不正确的。事实上,为了我自己的名字,杰·雅各布·风,这个公式失效了。正确的公式是:

Assuming Last, First is in column A, separated by one comma and a space bar

假设最后,第一列在A中,用一个逗号和一个空格分隔

For first name:

第一个名字:

=mid(A2,find(",",A2)+2,99)

For last name:

姓名:

=mid(A2,1,find(",",A2)-1)

Put together, assuming Column B is First Name and Column C is Last Name =B2&" "&C2

把它们放在一起,假设列B是名,列C是名=B2&" "&C2

or simply (but more complexly)

或者简单(但更复杂)

=mid(A2,find(",",A2)+2,99)&" "&mid(A2,1,find(",",A2)-1)

but I like separating them into two columns, then concatenating them

但是我喜欢把它们分成两列,然后把它们串联起来

#1


14  

If the first name is in A2 try this formula in B2 copied down

如果第一个名字在A2中,试试这个公式在B2中复制下来

=MID(A2&" "&A2,FIND(" ",A2)+1,LEN(A2)-1)

=中期(A2”“&A2,找到“A2 + 1,LEN(A2)1)

#2


1  

Enter data into cells e.g.

向单元格中输入数据。

Brown, John
Green, Bob
Smith, Will

(Note that the comma in this case is the delimiter which the system will use to separate the entries) Highlight these cells.
Click on the "Data" tab, click on "Text to Column".
Choose options offered.

(注意,在本例中,逗号是分隔符,系统将使用它来分隔条目)突出显示这些单元格。点击“Data”选项卡,点击“Text to Column”。选择选项提供。

#3


0  

The worked for me =RIGHT(C3,LEN(C3)-LEN(LEFT(C3,FIND(",",C3)-1))-1) & " " & LEFT(C3,FIND(",",C3)-1)

为我工作=右(C3,LEN(C3)兰(左(C3,发现(”、“C3)1))1)& " " &左(C3,发现(”、“C3)1)

#4


-3  

The above answer is incorrect. In fact, for my own name, Jay Jacob Wind, the formula breaks. The correct formula is:

上面的答案是不正确的。事实上,为了我自己的名字,杰·雅各布·风,这个公式失效了。正确的公式是:

Assuming Last, First is in column A, separated by one comma and a space bar

假设最后,第一列在A中,用一个逗号和一个空格分隔

For first name:

第一个名字:

=mid(A2,find(",",A2)+2,99)

For last name:

姓名:

=mid(A2,1,find(",",A2)-1)

Put together, assuming Column B is First Name and Column C is Last Name =B2&" "&C2

把它们放在一起,假设列B是名,列C是名=B2&" "&C2

or simply (but more complexly)

或者简单(但更复杂)

=mid(A2,find(",",A2)+2,99)&" "&mid(A2,1,find(",",A2)-1)

but I like separating them into two columns, then concatenating them

但是我喜欢把它们分成两列,然后把它们串联起来