简体   繁体   English

Excel查找名称的公式拆分字符串

[英]Excel Find formula split string of names

I'm trying to split a list of names, They in the form of: 我正在尝试拆分名称列表,它们的形式为:

Surname, Title. Firstname (Nickname)

Jonesy, Mr. Cheese (Edam)
Bukowski, Mrs. Gertrude (Gerti)

I need to put them into Firstname Surname 我需要把它们放在名字上

It should be easy to pick up the Firstname: Two characters after the dot of Title up to the space before the left bracket of Nickname. 取名字应该很容易:在标题点后两个字符到昵称左括号之前的空格。 Only my excel formula doesn't give me what I want. 只有我的excel公式无法满足我的需求。

A1 Smith, Mr. Andrew (Andy)
A2 =MID(A1,1,Find(" ",A1)-2)
A3 =MID(A1,Find(".",A1)+2, Find("(",A1)+1)

Only for A3 I get: 仅对于A3我得到:

Andrew (Andy)

Instead of just the name Andrew 不只是名字安德鲁

I'll add the caveat that I need the formula to refer to the name cell and not an cell with temp data to be referenced (ie an interim cell) 我要加注的一点是,我需要公式来引用名称单元,而不是要引用具有临时数据的单元(即临时单元)

I can't see the woods for the trees on this one. 我看不到这棵树木的树林。 Need to call in a bigger brain. 需要召唤更大的大脑。

Assuming a data setup where headers are in row 1, with your "Complete Name" in column A starting in row 2, like so: 假设数据设置的标题位于第1行,而您的“完整名称”位于A列,则从第2行开始,如下所示:

在此处输入图片说明

In cell B2 and copied down is this formula to get the first name: 在单元格B2中,向下复制该公式即可得到名字:

=MID(A2,FIND(".",A2)+2,FIND("(",A2)-FIND(".",A2)-3)

In cell C2 and copied down is this formula to get the last name: 在单元格C2中,向下复制此公式可得出姓氏:

=LEFT(A2,FIND(",",A2)-1)

You can use this single formula to get the Firstname Surname : 您可以使用以下单个公式来获取“ Firstname Surname

=TRIM(MID(A1,SEARCH(".",A1)+1,SEARCH("(",A1)-SEARCH(".",A1)-1))&" "&MID(A1,1,FIND(" ",A1)-2)

在此处输入图片说明

Pretty Simple I think....(Famous last words). 我认为这很简单...(著名的遗言)。

You had: 你有过:

A1 = Smith, Mr. Andrew (Andy)
A2 =MID(A1,1,Find(" ",A1)-2)
A3 =MID(A1,Find(".",A1)+2, Find("(",A1)+1)

I replaced the A# Find "(" with " " and it worked. 我用“”替换了A#查找“(”,并且成功了。

A1 = Smith, Mr. Andrew (Andy)
A2 =MID(A1,1,Find(" ",A1)-2)
A3 =MID(A1,Find(".",A1)+2, Find(" ",A1)+1)

This will only work if you have a single Firstname though. 但是,只有在您只有一个名字的情况下,这才起作用。 A name like Bobby Joe or Billy Bob will cut off at Bobby and Billy. 像Bobby Joe或Billy Bob这样的名字将在Bobby和Billy切断。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM