跳到主要內容

Excel公式:從電子郵件地址中提取名字和姓氏

本教程介紹了從給定的電子郵件地址中提取名字和姓氏到單獨的單元格中的公式,如下面的屏幕快照所示,它還提供了示例來解釋公式的參數和部分。
doc從文件名5中提取擴展名

提取名字

通用公式:

LEFT(e_address,FIND("separator",)-1)

參數

E_address: the email address you want to extract the first name.
Separator: the delimiter between first name and last name.

這個公式如何運作

要從單元格B3中的電子郵件地址中提取名字,請使用以下公式:

=LEFT(B3,FIND("_",B3)-1)

媒體推薦 Enter 鍵。
doc提取姓氏電子郵件2

解釋

FIND 功能:查找給定文本字符串中字符或文本的開始位置。 公式 FIND(“ _”,B3) 在單元格B3中找到字符“ _”的位置,返回4。

LEFT 功能:根據給定的文本長度從給定的文本字符串的左側提取文本。 公式LEFT(B3,FIND(“ _”,B3)-1) 可以看作是 左(B3,4-1),從單元格B3中的文本中提取前3個字符。

提取姓氏

通用公式

LEFT(RIGHT(e_address,LEN(e_address)-FIND("separacter",e_address)),FIND("@",RIGHT(e_address,LEN(e_address)-FIND("separator",e_address)))-1)

爭論

E_address: the email address you want to extract the first name.
Separator: the delimiter between first name and last name.

這個公式如何運作

要從單元格B3中的電子郵件地址中提取姓氏,請使用以下公式:

=LEFT(RIGHT(B3,LEN(B3)-FIND("_",B3)),FIND("@",RIGHT(B3,LEN(B3)-FIND("_",B3)))-1)

媒體推薦 Enter 鍵。
doc提取姓氏電子郵件3

解釋

FIND 功能:查找給定文本字符串中字符或文本的開始位置。

LEN 功能:計算文本字符串的數量。

RIGHT 功能:從右側提取文本。

其計算公式 RIGHT(B3,LEN(B3)-FIND(“ _”,B3)) 可以看作是:
=右(B3,LEN(B3)-4)
= RIGHT(B3,17)
=""

然後 FIND(“ @”,RIGHT(B3,LEN(B3)-FIND(“ _”,B3))) 可以看作是
=查找(“@”,")
=“ 6”

LEFT 功能:根據給定的文本長度從給定的文本字符串的左側提取文本。 公式 LEFT(RIGHT(B3,LEN(B3)-FIND("_",B3)),FIND("@",RIGHT(B3,LEN(B3)-FIND("_",B3)))-1) 可以看作是這些:
=LEFT(RIGHT(B3,LEN(B3)-FIND("_",B3)),6-1)
=左(“",5)
=“史密斯”

備註

如果要提取首字母大寫的名字和姓氏,則可以在上述公式的前面添加PROPER函數,例如:

= PROPER(LEFT(B3,FIND(“ _”,B3)-1))
=PROPER(LEFT(RIGHT(B3,LEN(B3)-FIND("_",B3)),FIND("@",RIGHT(B3,LEN(B3)-FIND("_",B3)))-1))
doc提取姓氏電子郵件4

示例文件

doc樣本點擊下載示例文件


相對公式


相關功能

  • RIGHT功能
    從右側提取文本。
  • 左功能
    從文本字符串的左側提取文本。
  • LEN功能
    獲取文本中的字符數。
  • 搜索功能
    從給定的文本字符串中找到特定字符或子字符串的位置。
  • 查找功能
    在另一個字符串中找到一個字符串

最佳辦公效率工具

Kutools for Excel-幫助您從人群中脫穎而出

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項  |  刪除空白行  |  合併列或儲存格而不遺失數據  |  沒有公式的回合 ...
超VLookup: 多重標準  |  多重價值  |  跨多頁  |  模糊查詢...
副詞。 下拉清單: 簡易下拉列表  |  依賴下拉列表  |  多選下拉列表...
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  將列與 選擇相同和不同的單元格 ...
特色功能: 網格焦點  |  設計圖  |  大方程式酒吧  |  工作簿和工作表管理器 | 資源庫 (自動文字)  |  日期選擇器  |  合併工作表  |  加密/解密單元格  |  按清單發送電子郵件  |  超級濾鏡  |  特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符 ...)  |  50+ 圖表 類型 (甘特圖 ...)  |  40+ 實用 公式 (根據生日計算年齡 ...)  |  19 插入 工具 (插入二維碼, 從路徑插入圖片 ...)  |  12 轉化 工具 (數字到單詞, 貨幣兌換 ...)  |  7 合併與拆分 工具 (高級合併行, 拆分 Excel 儲存格 ...)  |  ... 和更多

Kutools for Excel 擁有超過 300 個功能, 確保只需點擊一下即可獲得您所需要的...

產品描述


Office選項卡-在Microsoft Office(包括Excel)中啟用選項卡式閱讀和編輯

  • 一秒鐘即可在數十個打開的文檔之間切換!
  • 每天為您減少數百次鼠標單擊,告別鼠標手。
  • 查看和編輯多個文檔時,將您的工作效率提高 50%。
  • 為 Office(包括 Excel)帶來高效的選項卡,就像 Chrome、Edge 和 Firefox 一樣。
Comments (5)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
<body><table border="1" cellspacing="0" cellpadding="4">
  <tbody style="font-family:sans-serif">
    <tr bgcolor="#999999" style="color:#ffffff;">
      <td>Email Address</td>
      <td>First Name</td>
      <td>Last Name</td>
      <td>Domain</td>
      <td>Separator</td>
    </tr>
    <tr>
      <td></td>
      <td>Jane</td>
      <td>Doe</td>
      <td>abc.com</td>
      <td>“_”</td>
    </tr>
    <tr bgcolor="#eeeeee">
      <td></td>
      <td>John</td>
      <td>Smith</td>
      <td>cbs.com</td>
      <td>“.”</td>
    </tr>
    <tr>
      <td></td>
      <td>G</td>
      <td>Jones</td>
      <td>nbc.com</td>
      <td>none</td>
    </tr>
  </tbody>
This comment was minimized by the moderator on the site
<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 15 (filtered)">
<style id="email_address_parser_18438_Styles">
<!--
col
	{mso-width-source:auto;}

 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin-right:0in;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Calibri",sans-serif;
	color:black;}
.MsoChpDefault
	{font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
-->
</style>

</head>

<body lang=EN-US link="#0563C1" vlink="#954F72" style='word-wrap:break-word'>

<div class=WordSection1>

<p class=MsoNormal style='margin:0in'><span style='font-family:"Times New Roman",serif;
color:windowtext'>&nbsp;&nbsp; </span></p>

<!--The following information was generated by Microsoft Excel's Publish as Web
Page wizard.--><!--If the same item is republished from Excel, all information between the DIV
tags will be replaced.--><!-----------------------------><!--START OF OUTPUT FROM EXCEL PUBLISH AS WEB PAGE WIZARD --><!----------------------------->

<div align=center>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=659
 style='width:494.0pt;border-collapse:collapse'>
 <col width=148 span=2 style='mso-width-source:userset;mso-width-alt:4736;
 width:111pt'><col width=99 style='mso-width-source:userset;mso-width-alt:3157;width:74pt'><col width=96 style='mso-width-source:userset;mso-width-alt:3072;width:72pt'><col width=77 style='mso-width-source:userset;mso-width-alt:2474;width:58pt'><col width=91 style='mso-width-source:userset;mso-width-alt:2901;width:68pt'>
 <tr style='height:16.0pt'>
  <td width=148 nowrap valign=bottom style='width:111.0pt;border:solid #C9C9C9 1.0pt;
  border-right:none;background:#A5A5A5;padding:.75pt .75pt 0in .75pt;
  height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><b><span style='color:white'>Subscriber
  Key</span></b></p>
  </td>
  <td width=148 nowrap valign=bottom style='width:111.0pt;border-top:solid #C9C9C9 1.0pt;
  border-left:none;border-bottom:solid #C9C9C9 1.0pt;border-right:none;
  background:#A5A5A5;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><b><span style='color:white'>Email
  Address</span></b></p>
  </td>
  <td width=99 nowrap valign=bottom style='width:74.0pt;border-top:solid #C9C9C9 1.0pt;
  border-left:none;border-bottom:solid #C9C9C9 1.0pt;border-right:none;
  background:#A5A5A5;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><b><span style='color:white'>First Name</span></b></p>
  </td>
  <td width=96 nowrap valign=bottom style='width:1.0in;border-top:solid #C9C9C9 1.0pt;
  border-left:none;border-bottom:solid #C9C9C9 1.0pt;border-right:none;
  background:#A5A5A5;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><b><span style='color:white'>Last Name</span></b></p>
  </td>
  <td width=77 nowrap valign=bottom style='width:58.0pt;border-top:solid #C9C9C9 1.0pt;
  border-left:none;border-bottom:solid #C9C9C9 1.0pt;border-right:none;
  background:#A5A5A5;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><b><span style='color:white'>Domain</span></b></p>
  </td>
  <td width=91 nowrap valign=bottom style='width:68.0pt;border:solid #C9C9C9 1.0pt;
  border-left:none;background:#A5A5A5;padding:.75pt .75pt 0in .75pt;height:
  16.0pt'>
  <p class=MsoNormal style='margin:0in'><b><span style='color:white'>Separator</span></b></p>
  </td>
 </tr>
 <tr style='height:16.0pt'>
  <td nowrap valign=bottom style='border-top:none;border-left:solid #C9C9C9 1.0pt;
  border-bottom:solid #C9C9C9 1.0pt;border-right:none;background:#EDEDED;
  padding:.75pt .75pt 0in .75pt;height:16.0pt;box-sizing: border-box'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'></span></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  background:#EDEDED;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  background:#EDEDED;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>Jane</span></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  background:#EDEDED;padding:.75pt .75pt 0in .75pt;height:16.0pt;box-sizing: border-box'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>Doe</span></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  background:#EDEDED;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>abc.com</span></p>
  </td>
  <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom:
  solid #C9C9C9 1.0pt;border-right:solid #C9C9C9 1.0pt;background:#EDEDED;
  padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>“_”</span></p>
  </td>
 </tr>
 <tr style='height:16.0pt'>
  <td nowrap valign=bottom style='border-top:none;border-left:solid #C9C9C9 1.0pt;
  border-bottom:solid #C9C9C9 1.0pt;border-right:none;padding:.75pt .75pt 0in .75pt;
  height:16.0pt;box-sizing: border-box'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'></span></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>John</span></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  background:#EDEDED;padding:.75pt .75pt 0in .75pt;height:16.0pt;box-sizing: border-box'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>Smith</span></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>cbs.com</span></p>
  </td>
  <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom:
  solid #C9C9C9 1.0pt;border-right:solid #C9C9C9 1.0pt;padding:.75pt .75pt 0in .75pt;
  height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>‘,”</span></p>
  </td>
 </tr>
 <tr style='height:16.0pt'>
  <td nowrap valign=bottom style='border-top:none;border-left:solid #C9C9C9 1.0pt;
  border-bottom:solid #C9C9C9 1.0pt;border-right:none;background:#EDEDED;
  padding:.75pt .75pt 0in .75pt;height:16.0pt;box-sizing: border-box'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'></span></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  background:#EDEDED;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  background:#EDEDED;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>G</span></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  background:#EDEDED;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>Jones</span></p>
  </td>
  <td nowrap valign=bottom style='border:none;border-bottom:solid #C9C9C9 1.0pt;
  background:#EDEDED;padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>nbc.com</span></p>
  </td>
  <td nowrap valign=bottom style='border-top:none;border-left:none;border-bottom:
  solid #C9C9C9 1.0pt;border-right:solid #C9C9C9 1.0pt;background:#EDEDED;
  padding:.75pt .75pt 0in .75pt;height:16.0pt'>
  <p class=MsoNormal style='margin:0in'><span style='color:#A6A6A6'>none</span></p>
  </td>
 </tr>
 <tr>
  <td width=148 nowrap valign=bottom style='width:111.0pt;padding:.75pt .75pt 0in .75pt'></td>
  <td width=148 nowrap valign=bottom style='width:111.0pt;padding:.75pt .75pt 0in .75pt'></td>
  <td width=99 nowrap valign=bottom style='width:74.0pt;padding:.75pt .75pt 0in .75pt'></td>
  <td width=96 nowrap valign=bottom style='width:1.0in;padding:.75pt .75pt 0in .75pt'></td>
  <td width=77 nowrap valign=bottom style='width:58.0pt;padding:.75pt .75pt 0in .75pt'></td>
  <td width=91 nowrap valign=bottom style='width:68.0pt;padding:.75pt .75pt 0in .75pt'></td>
 </tr>
</table>

</div>

<p class=MsoNormal style='margin:0in'><span style='font-family:"Times New Roman",serif;
color:windowtext'>&nbsp;</span></p>

<!-----------------------------><!--END OF OUTPUT FROM EXCEL PUBLISH AS WEB PAGE WIZARD--><!-----------------------------></div>

</body>

</html>
This comment was minimized by the moderator on the site
This supports any separator by simply adding or replacing the MIN array. It also proper cases the name:

** First Name **

=PROPER(
    LEFT(
        LEFT(
            [@[Email Address]],
            FIND(
                "@",
                [@[Email Address]]
            ) - 1
        ),
        MIN(
            IFERROR(
                FIND(
                    {
                     ".",
                     "_"
                    },
                    LEFT(
                        [@[Email Address]],
                        FIND(
                            "@",
                            [@[Email Address]]
                        ) - 1
                    )
                ),
                ""
            )
        ) - 1
    )
)


** Last Name **

=PROPER(
    RIGHT(
        LEFT(
            [@[Email Address]],
            FIND(
                "@",
                [@[Email Address]]
            ) - 1
        ),
        LEN(
            LEFT(
                [@[Email Address]],
                FIND(
                    "@",
                    [@[Email Address]]
                ) - 1
            )
        ) -
        MIN(
            IFERROR(
                FIND(
                    {".","_"},
                    LEFT(
                        [@[Email Address]],
                        FIND(
                            "@",
                            [@[Email Address]]
                        ) - 1
                    )
                ),
                ""
            )
        )
    )
)
This comment was minimized by the moderator on the site
I realized using the @ within the command also helped but did not isolate the first and last name where applicable.
=PROPER(LEFT(A4,FIND("@",A4)-1))

I will keep researching and hopefully be able to fine tune better

Thank you very much for this article.
Rated 5 out of 5
This comment was minimized by the moderator on the site
Thank you very much for this article. I have another question regarding these formula.
- Say I have these scenarios - I want to separate FNAME & LNAME from this email
With this command =PROPER(LEFT(A4,FIND("_",A4)-1)); I will be able to produce Ann Bee, but this sign "__ must be changed to "." ,

How do I fix this when this happens say I have - this previous command will produce abee@yahoo as the first name when I am looking to achieve Abee....please can you help.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations