我正在尝试获得一个名为Jane Doe和John Smith的excel电子表格,从那里转到Doe,Jane和Smith,John。
我只能找到从lastName,firstName到firstName lastName的方法,但是没有相反的方法。
谢谢。
答案 0 :(得分:2)
对于公式使用:
=MID(A1,FIND(" ",A1)+1,999) & ", " & LEFT(A1,FIND(" ",A1)-1)
现在回答下一个问题:如果不仅仅是名字和姓氏怎么办?
使用此:
=MID(A1,FIND("}}}",SUBSTITUTE(A1," ","}}}",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+1,999) & ", " & LEFT(A1,FIND("}}}",SUBSTITUTE(A1," ","}}}",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-1)
它将假设最后一个单词是姓氏。
答案 1 :(得分:2)
仅选择要转换的单元格并运行此小宏:
Sub NameFixer()
For Each r In Selection
ary = Split(r.Value, " ")
r.Value = ary(1) & ", " & ary(0)
Next r
End Sub
答案 2 :(得分:1)
替代配方解决方案:
=LEFT(TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))&", "&A1,LEN(A1)+1)