Skip to main content

Excel 教學:分割文字、數字與日期儲存格(拆分為多個欄位)

Author: Siluvia Last Modified: 2025-08-06

在使用 Excel 時,您可能會因不同需求需要將一個儲存格中的文字分割到多個儲存格。這份教學分為三大部分:分割文字儲存格、分割數字儲存格以及分割日期儲存格。每個部分都提供了不同的範例,協助您在遇到相同問題時能夠順利完成分割作業。

目錄: [ 隱藏 ]

(點擊下方或右側目錄中的任一標題,即可跳轉至對應章節。)

1 分割文字儲存格

本部分彙整了將文字儲存格分割為多個欄位時會遇到的情境,並提供對應的解決方法。

範例 #1依逗號、空格或其他分隔依據分割儲存格

若要依特定分隔依據(如逗號、空格、破折號等)將文字儲存格分割為多個欄位,您可以採用下列任一方法。

使用資料分欄功能依分隔依據分割儲存格

資料分欄功能是 Excel內建且常用於分割儲存格的工具。如以下螢幕截圖所示,若要將「Text Strings」欄中的儲存格依逗號分割,可依下列步驟使用資料分欄功能。

A screenshot of a text cell split into multiple columns

1. 選取您要依逗號分割的欄位區域,點選「資料」>「資料分欄」

A screenshot of the Text to Columns option in Excel ribbon

2. 在「 文字分欄精靈 –3 步驟之第1 步」對話框中,保持「分隔符號」選項,然後點選「下一步」。

A screenshot of the Convert Text to Columns Wizard – Step 1 of 3 dialog box with the Delimited option selected

3. 在「文字分欄精靈 –3 步驟之第2 步」對話框中,根據需求指定分隔依據(本例僅勾選「逗號」),然後點選「下一步」。

A screenshot of the Convert Text to Columns Wizard – Step 2 of 3 dialog box showing delimiters selection

4. 在最後一步對話框中,點選 Destination cell selection button 按鈕以選擇要輸出分割後文字的儲存格,然後點選 完成 按鈕。

A screenshot of selecting a cell for the output in the Convert Text to Columns Wizard

此時,選取區域中的文字會依逗號分割並分別放置於不同欄位,如下圖所示。

A screenshot of a text cell split into multiple columns

使用公式依分隔依據分割儲存格

您可以套用下方公式,依指定分隔依據分割 Excel 儲存格中的文字。

通用公式

=TRIM(MID(SUBSTITUTE(A1,delim,REPT(" ",LEN(A1))),(N-1)*LEN(A1)+1,LEN(A1)))

參數說明

Delim:用於分割文字字串的分隔依據;
A1:代表您要分割的文字字串所在儲存格;
N:代表您要分割的第 N 個子字串的數字。

接下來請依下列步驟套用此公式。

1. 如下圖所示,首先需建立一個輔助列,分別輸入1、2、3...於不同儲存格中。

備註:這裡的1、2、3...代表文字字串的第一、第二、第三個子字串。

A screenshot of a helper row with numbers 1, 2, 3... created for splitting text strings in Excel

2. 在數字1 下方的儲存格中,複製或輸入下方公式並按 Enter 鍵,即可取得第一個子字串。選取結果儲存格,向右及向下拖曳自動填滿控點以取得其他子字串。請參考下圖:

=TRIM(MID(SUBSTITUTE($B5,",",REPT(" ",LEN($B5))),(D$4-1)*LEN($B5)+1,LEN($B5)))

A screenshot showing the AutoFill Handle used to extend the formula for splitting text strings in Excel

備註:此公式中的「,」為分割 B5文字字串的分隔依據。您可依需求更改。

使用強大工具依分隔依據分割儲存格

這裡推薦您使用 Kutools for Excel 的「分割儲存格」功能,輕鬆依指定分隔依據將儲存格內容分割為多個欄位或列。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 安裝 Kutools for Excel 後,選取要分割文字字串的區域,然後點選 Kutools > 合併與分割 > 分割儲存格

A screenshot showing the Split Cells option under the Kutools tab in Excel

2. 在「分割儲存格」對話框中,請依下列方式設定。

2.1) 選取區域會顯示於「分割區域」欄位,您可依需求更改;
2.2) 在「類型」區段,選擇「分割至多行」或「資料分欄」單選鈕;
2.3) 在「分隔依據」區段,選擇所需分隔符號。若此區段未列出所需分隔符號,請選擇「其他」並於文字框輸入分隔符號。本例輸入逗號;
2.4) 點選「確定」。請參考下圖:

A screenshot of the Kutools Split Cells dialog box with delimiter configuration

3. 在下一個「分割儲存格」對話框中,選擇要輸出子字串的儲存格,然後點選「確定」。

A screenshot of the final Kutools Split Cells dialog box to select the output location

此時,子字串會依您在第2 步指定的方式分割至不同欄位或列。

資料分欄

A screenshot of text strings split into columns using Kutools

分割至多行

A screenshot of text strings split into rows using Kutools

範例 #2依指定長度分割儲存格

若需依指定長度分割文字字串,可採用以下方法協助您完成。

使用資料分欄功能依指定長度分割儲存格

資料分欄功能提供「固定寬度」選項,協助您依指定長度分割選取儲存格中的文字字串。

如下圖所示,若要將 B5:B9 區域的文字每3 個字元分割為不同欄位,可依下列步驟操作。

A screenshot showing cells to be split by fixed width

1. 選取欲分割文字字串的儲存格。

2. 點選「資料」 「資料分欄」

3. 在「文字分欄精靈 –3 步驟之第1 步」對話框中,選擇「固定寬度」單選鈕並點選「下一步」。

A screenshot of the Convert Text to Columns Wizard step 1 of 3 dialog box in Excel with Fixed width selected

4. 接著會彈出「 第2 步」對話框。在「 預覽」區段,於軸線上點擊所需位置建立分割線(帶箭頭的線)。建立所有分割線後,點選「下一步」繼續。

本例每3 個字元建立一條分割線。

A screenshot of the Convert Text to Columns Wizard step 2 of 3 dialog box with break lines placed to split text

5. 在最後一步精靈中,選擇要輸出分割後文字的儲存格,然後點選「完成」。

A screenshot of the Convert Text to Columns Wizard step 3 of 3 dialog box in Excel with output cell highlighted

此時,選取儲存格中的文字會每3 個字元分割為不同欄位,如下圖所示。

A screenshot of text strings split into separate columns every 3 characters in Excel

使用強大工具依指定長度分割儲存格

若要在 Excel 中依指定長度分割儲存格,可輕鬆套用 Kutools for Excel 的「分割儲存格 」功能完成。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 選取欲依指定長度分割的文字儲存格,點選 Kutools > 合併與分割 > 分割儲存格

2. 在「分割儲存格」對話框中,請依下列方式設定。

2.1) 第1 步選取的區域會顯示於「 分割區域」欄位,您可依需求更改;
2.2) 在「類型」區段,依需求選擇「分割至多行」或「資料分欄」選項;
2.3) 在「 分隔依據」區段,選擇「指定寬度」單選鈕,並輸入分割文字的字元數。本例輸入3;
2.4) 點選「確定」按鈕。

A screenshot of the Split Cells dialog box with Split by width option selected

3. 在下一個「分割儲存格」對話框中,選擇要放置分割後文字的儲存格,然後點選「確定」。

A screenshot of the Split Cells dialog box in Kutools for Excel with output destination selected

此時,選取儲存格中的文字會依指定長度分割並放置於不同欄位。

範例 #3依特定單詞分割儲存格

如下圖所示,若要將 B5:B9 區域的文字字串依整個單詞「sales」分割,可套用本節提供的公式。

A screenshot of text strings in Excel to be split by the word 'sales'

取得儲存格中特定單詞前的子字串

可套用基於 LEFT 與 FIND 函數的公式,取得文字字串中特定單詞前的子字串。

通用公式

=LEFT(A1,FIND("certain_word", A1)-1)

參數說明

A1:代表您要依特定單詞分割的文字字串所在儲存格;
Certain_word:用於分割文字字串的單詞。可為單詞所在儲存格的引用,或直接輸入加上雙引號的單詞;

1. 選取一個空白儲存格,複製或輸入下方公式並按 Enter 鍵,即可取得特定單詞前的子字串。選取此結果儲存格,向下拖曳 自動填滿控點以套用公式至其他儲存格。

=LEFT(B5,FIND("sales",B5)-1)

A screenshot of the formula used in Excel to get the substring before a certain word

取得儲存格中特定單詞後的子字串

取得單詞前的子字串後,需套用下方公式取得其後的子字串。

通用公式

=TRIM(MID(A1,SEARCH("certain_word",A1)+LEN("certain_word"),255))

參數說明

A1:代表您要依特定單詞分割的文字字串所在儲存格;
Certain_word:用於分割文字字串的單詞。可為單詞所在儲存格的引用,或直接輸入加上雙引號的單詞;

1. 選取第一個結果儲存格(D5)旁的空白儲存格。

2. 複製或輸入下方公式並按 Enter 鍵。選取此結果儲存格,向下拖曳自動填滿控點以取得其他結果。

=TRIM(MID(B5,SEARCH("sales",B5)+LEN("sales"),255))

A screenshot of the formula used in Excel to get the substring after a certain word

此時,您已依整個單詞將文字字串分割為不同欄位。

範例 #4依換行符號分割儲存格

本節介紹多種方法,協助您在 Excel 中依換行符號分割文字儲存格。

A screenshot of Excel with a table, showing the selected cells to be split by line breaks

使用資料分欄功能依換行符號分割儲存格

可套用資料分欄功能,將儲存格依換行符號分割。請依下列步驟操作。

1. 選取欲依換行符號分割文字的儲存格區域。

2. 點選「資料」>「資料分欄」

3. 在「文字分欄精靈 –3 步驟之第1 步」對話框中,選擇「分隔符號」單選鈕,然後點選「下一步」;

A screenshot of the Convert Text to Columns Wizard in Excel, showing the Delimited option selected

4. 在「第2 步」對話框中,取消所有現有分隔符號選項,勾選「其他」並按下 Ctrl + J 快捷鍵。您會看到文字框中僅顯示一個小點,預覽區的文字已依換行符號分割。點選「下一步」。

A screenshot of the Step 2 of 3 dialog box in Excel with the Other delimiter selected and Ctrl + J entered

5. 在最後一步精靈中,選擇要輸出分割後文字的儲存格,然後點選「完成」。

A screenshot of the final step of the Text to Columns Wizard in Excel, showing the destination cell selected

此時,選取儲存格中的文字會依換行符號分割為不同欄位。

使用公式依換行符號分割儲存格

下列公式同樣可協助您在 Excel 中依換行符號分割儲存格。

以相同範例為例,分割後可取得三個子字串分別位於不同欄位。

取得第一個換行符號前的子字串

首先可套用基於 LEFTSEARCH 函數的公式,分割儲存格中第一個換行符號前的子字串。

通用公式

=LEFT(cell, SEARCH(CHAR(10),cell,1)-1)

參數說明

Cell:欲分割第一個換行符號前子字串的文字儲存格。

1. 選取空白儲存格(本例為 D5),複製或輸入下方公式並按 Enter 鍵。選取結果儲存格,向下拖曳 自動填滿控點 以取得其他儲存格第一個換行符號前的子字串。

=LEFT(B5, SEARCH(CHAR(10),B5,1)-1)

A screenshot of the Excel sheet showing a formula for extracting a substring before the first line break

取得第一個與第二個換行符號間的子字串

若要取得儲存格中第一個與第二個換行符號間的子字串,可套用下列公式。

通用公式

=MID(cell,SEARCH(CHAR(10),cell)+1,SEARCH(CHAR(10),cell,SEARCH(CHAR(10),cell)+1)-SEARCH(CHAR(10),cell)-1)

參數說明

Cell:欲分割第一個與第二個換行符號間子字串的文字儲存格。

1. 在 D5右側的 E5 儲存格中,複製或輸入下方公式並按 Enter 鍵。選取結果儲存格,向下拖曳自動填滿控點以取得其他儲存格第一個與第二個換行符號間的子字串。

=MID(B5, SEARCH(CHAR(10),B5) +1, SEARCH(CHAR(10),B5,SEARCH(CHAR(10),B5)+1) - SEARCH(CHAR(10),B5) -1)

A screenshot of the Excel sheet showing a formula for extracting a substring between the first and second line breaks

取得第二個換行符號後的子字串

第一步是使用下方公式取得第二個換行符號後的子字串。

通用公式

=RIGHT(cell,LEN(cell) - SEARCH(CHAR(10),cell, SEARCH(CHAR(10), cell) +1))

參數說明

Cell:欲分割第二個換行符號後子字串的文字儲存格。

1. 在 F5 儲存格中,複製或輸入下方公式並按 Enter 鍵。選取結果儲存格,向下拖曳自動填滿控點以取得其他儲存格第二個換行符號後的子字串。

=RIGHT(B5,LEN(B5) - SEARCH(CHAR(10), B5, SEARCH(CHAR(10), B5) +1))

A screenshot of the Excel sheet showing a formula for extracting a substring after the second line break

使用 VBA依換行符號分割儲存格

本節提供 VBA 程式碼,協助您在 Excel 中輕鬆依換行符號分割選取儲存格的文字。

1. 按下 Alt + F11 開啟 Microsoft Visual Basic for Applications 視窗。

2. 在 Microsoft Visual Basic for Applications 視窗中,點選「插入」>「模組」。然後將下方 VBA 貼入程式碼視窗。

VBA 程式碼:在 Excel 中依換行符號分割儲存格

Sub ExtendOffice_SplitRangeTex()
'Updated by Extendoffice 20211116
Dim xStr() As String
Dim xRg As Range
Dim xCell As Range
Dim xI As Integer
Set xRg = Application.InputBox("Please select the range of cells where you want to split by line break:", "Kutools for Excel", "", , , , , 8)
If xRg Is Nothing Then Exit Sub
For xI = 1 To xRg.Count
    Set xCell = xRg.Item(xI)
    xStr = VBA.Split(xCell.Value, vbLf)
    xCell.Resize(1, UBound(xStr) + 1).Offset(0, 1) = xStr
Next
End Sub

A screenshot of the Microsoft Visual Basic for Applications window showing VBA code to split cells by line breaks

3. 按下 F5 執行程式碼。此時會跳出 Kutools for Excel 對話框,請選取欲依換行符號分割的儲存格範圍,最後點選「確定」。

A screenshot of the Kutools for Excel dialog box with the range of cells selected to split by line break

此時,選取儲存格中的文字會立即依換行符號分割為不同欄位。

A screenshot of the result after splitting cells by line break in Excel using Kutools

使用強大工具依換行符號分割儲存格

這裡介紹 Kutools for Excel 的「分割儲存格 」工具,讓您只需幾個步驟即可批次依換行符號分割選取儲存格中的文字。

1. 選取欲依換行符號分割文字的儲存格區域。

2. 點選 Kutools > 合併與分割 > 分割儲存格以啟用此功能。

3. 在「分割儲存格」對話框中,請進行以下設定。

3.1) 在「分割區域」欄位,保留選取區域或更改為新區域;
3.2) 在「類型」區段,依需求選擇「 分割至多行」或「 資料分欄」;
3.3) 在「分隔依據」區段,選擇「另起一行」單選鈕;
3.4) 點選「確定」。請參考下圖:

A screenshot of the Split Cells dialog box with settings to split by line breaks

4. 在下一個彈出的「分割儲存格」對話框中,選取空白儲存格以放置分割後文字,然後點選「確定」。

A screenshot of the Split Cells dialog box with the destination cell selected

此時,選取儲存格中的文字會依換行符號分割為不同欄位,如下圖所示。

A screenshot showing the result of splitting text by line breaks in Excel using Kutools

Kutools for Excel - 超過 300 種必備工具,讓 Excel 功能更強大。永久免費享受 AI 功能!立即獲取

範例 #5 僅依第一個或最後一個分隔依據分割儲存格

有時,您可能只需依第一個或最後一個分隔依據將儲存格分為兩部分,可嘗試下列公式。

使用公式依第一個分隔依據分割儲存格

如下圖所示,若要將 B5:B9 區域的每個儲存格依第一個空格分為兩部分,需套用兩個公式。

A screenshot of splitting text by the first space in Excel

分割第一個空格前的子字串

可使用基於 LEFT 與 FIND 函數的公式分割第一個空格前的子字串。

通用公式

=LEFT(cell,FIND("delimiter",cell)-1)

參數說明

Cell:欲分割第一個空格前子字串的文字儲存格。
Delimiter:用於分割儲存格的分隔依據。

1. 選取儲存格(本例為 D5)以輸出子字串,複製或輸入下方公式並按 Enter 鍵。選取結果儲存格,向下拖曳 自動填滿控點 以取得其他儲存格的子字串。

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

A screenshot of the formula for splitting text before the first space in Excel

分割第一個空格後的子字串

接著套用下方公式,取得儲存格中第一個空格後的子字串。

通用公式

=RIGHT(cell,LEN(cell)-FIND("delimiter",cell))

參數說明

Cell:欲分割第一個空格後子字串的文字儲存格。
Delimiter:用於分割儲存格的分隔依據。

1. 複製或輸入下方公式至 E5 儲存格並按 Enter 鍵取得結果。選取此結果儲存格,向下拖曳自動填滿控點以取得其他儲存格最後一個空格後的子字串。

=RIGHT(B5,LEN(B5)-FIND(" ",B5))

A screenshot of the result for splitting text after the first space in Excel

備註:公式中的儲存格引用與分隔依據可依需求更改。

使用公式依最後一個分隔依據分割儲存格

若要將 B5:B9 區域的文字依最後一個空格分為兩部分,可套用本節提供的兩個公式。

A screenshot of splitting text by the last space in Excel

取得最後一個分隔依據左側的文字

可套用下方公式取得儲存格中最後一個分隔依據左側的文字。

通用公式

=LEFT(B5,SEARCH("^",SUBSTITUTE(cell,"delimiter","^",LEN(cell)-LEN(SUBSTITUTE(cell,"delimiter",""))))-1)

參數說明

Cell:欲分割最後一個分隔依據左側文字的儲存格。
Delimiter:用於分割儲存格的分隔依據。

1. 選取儲存格以放置左側子字串,複製或輸入下方公式並按 Enter 鍵。選取結果儲存格,向下拖曳 自動填滿控點 以套用至其他儲存格。

=LEFT(B5,SEARCH("^",SUBSTITUTE(B5," ","^",LEN(B5)-LEN(SUBSTITUTE(B5," ",""))))-1)

A screenshot of the formula for splitting text before the last space in Excel

取得最後一個分隔依據右側的文字

本例需取得最後一個空格右側的文字。

通用公式

=TRIM(RIGHT(SUBSTITUTE(cell,"delimiter",REPT("delimiter",LEN(cell))),LEN(cell)))

參數說明

Cell:欲分割最後一個分隔依據右側文字的儲存格。
Delimiter:用於分割儲存格的分隔依據。

1. 選取儲存格以放置右側子字串,複製或輸入下方公式並按 Enter 鍵。選取結果儲存格,向下拖曳自動填滿控點以套用至其他儲存格。

=TRIM(RIGHT(SUBSTITUTE(B5," ",REPT(" ",LEN(B5))),LEN(B5)))

A screenshot of the formula for splitting text after the last space in Excel

備註:公式中的儲存格引用與分隔依據可依需求更改。

範例 #6依大寫字母分割儲存格

本節介紹自訂函數,協助您依大寫字母分割儲存格中的單詞。

A screenshot of splitting text by capital letter in Excel

1. 按下 Alt + F11 開啟 Microsoft Visual Basic for Applications 視窗。

2. 在 Microsoft Visual Basic for Applications 視窗中,點選「插入」>「模組」,然後將下方 VBA 程式碼貼入程式碼視窗。

VBA 程式碼:在 Excel 中依大寫字母分割儲存格

Function GetName(s As String, Num As Long) As String
'Updated by Extendoffice 20211116
  With CreateObject("VBSCript.RegExp")
    .Global = True
    .Pattern = "[A-Z][a-z]+|[A-Z]"
    GetName = .Execute(s).Item(Num - 1)
  End With
End Function

3. 按下 Alt + Q 關閉 Microsoft Visual Basic for Applications 視窗。

4. 選取儲存格(本例為 D5)以輸出第一個大寫字母左側的單詞,輸入下方公式並按 Enter 鍵。選取此結果儲存格,向右再向下拖曳 自動填滿控點 以取得其他單詞。

=IFERROR(GetName($B5,COLUMNS($D:D)),"")

A screenshot of the result of splitting text by capital letter using VBA

備註:程式碼中的 $B5 為欲分割的儲存格,$D:D 為結果儲存格的欄位。請依實際資料調整。

範例 #7 分割儲存格中的姓名

假設您有一份包含全名的工作表,想將全名分割為不同欄位,例如將姓與名分開,或將姓、中間名、名分開。本節提供詳細步驟協助您解決這些問題。

將全名分割為姓與名

如下圖所示,姓、中間名與名以單一空格分隔,若僅需將全名分割為姓與名並分別放入不同欄位,可採用下列任一方法。

A screenshot showing a column of full names to be split into separate columns for first and last names

1) 使用公式將全名分割為姓與名

需分別套用兩個公式,將全名分割為姓與名。

從全名中分割出姓

可套用基於 LEFT 與 SEARCH 函數的公式,從全名中分割出姓。

通用公式

=LEFT(cell, SEARCH(" ", cell) -1)

1. 選取儲存格以輸出姓。

2. 複製或輸入下方公式並按 Enter 鍵。選取此結果儲存格,向下拖曳自動填滿控點以分割其他全名的姓。

=LEFT(B5, SEARCH(" ", B5) -1)

A screenshot of the formula used to split the first name from a full name in Excel

此時,指定區域內所有全名的姓已分割完成,接著可套用下方公式分割名。

從全名中分割出名

通用公式

=RIGHT(cell, LEN(cell) - SEARCH("^", SUBSTITUTE(cell," ", "^", LEN(cell) - LEN(SUBSTITUTE(cell, " ", "")))))

1. 選取姓旁的儲存格。

2. 複製或輸入下方公式並按 Enter 鍵。選取此結果儲存格,向下拖曳自動填滿控點以分割其他全名的名。

=RIGHT(B5, LEN(B5) - SEARCH("^", SUBSTITUTE(B5," ", "^", LEN(B5) - LEN(SUBSTITUTE(B5, " ", "")))))

A screenshot of the formula used to split the last name from a full name in Excel

備註:公式中的 B5 為欲分割的全名儲存格,可依需求更改。

2) 使用強大工具將全名分割為姓與名

許多 Excel 使用者難以記住公式。這裡推薦 Kutools for Excel 的「分割姓名 」功能,讓您只需幾個步驟即可輕鬆將全名分割為姓與名。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 選取全名儲存格區域,點選 Kutools > 合併與分割 > 分割姓名

A screenshot of the Split Names option in Kutools tab in Excel

2. 在「分割姓名」對話框中,僅勾選「姓」 「名」分割類型區段,然後點選「確定」

提示:選取區域會顯示於「分割區域」欄位,您可依需求更改。

A screenshot showing the Split Names dialog box where First and Last Name are selected to be split

3. 隨後會跳出另一個「分割姓名」對話框,選擇目的儲存格並點選「確定」。

A screenshot of the Split Names dialog box where the user selects a destination cell

此時,選取儲存格中的全名會批次分割為姓與名,如下圖所示。

A screenshot showing the results after splitting full names into first and last names in Excel using Kutools

Kutools for Excel - 超過 300 種必備工具,讓 Excel 功能更強大。永久免費享受 AI 功能!立即獲取

將全名分割為姓、中間名與名

如下圖所示,全名欄位以單一空格分隔姓、中間名與名。若需將全名分割為姓、中間名與名並分別放入不同欄位,可採用下列方法。

A screenshot of a column containing full names with first, middle, and last names separated by spaces

1) 使用資料分欄將全名分割為姓、中間名與名

內建的資料分欄功能可協助您輕鬆將全名分割為姓、中間名與名。

您可依前述步驟套用資料分欄功能

備註:於第2 步精靈中,僅勾選「空格」方塊。

2) 使用公式將全名分割為姓、中間名與名

同樣可套用公式,將全名分割為姓、中間名與名。

分割全名常用公式

分割姓

=LEFT(cell,SEARCH(" ", cell)-1)

分割中間名

=MID(cell, SEARCH(" ", cell) +1, SEARCH(" ", cell, SEARCH(" ", cell)+1) - SEARCH(" ", cell)-1)

分割名

=RIGHT(cell,LEN(cell) - SEARCH(" ",cell, SEARCH(" ",cell,1)+1))

請將上述公式分別套用於不同儲存格,即可取得姓、中間名與名。

1. 在 D5 儲存格輸入下方公式並按 Enter 鍵。選取此結果儲存格,向下拖曳自動填滿控點以取得其他全名的姓。

=LEFT(B5,SEARCH(" ", B5)-1)

A screenshot of the formula used to split the first name from a full name into a separate column

2. 在 E5 儲存格輸入下方公式並按 Enter 鍵取得第一個中間名。選取結果儲存格,向下拖曳自動填滿控點以取得其他中間名。

=MID(B5, SEARCH(" ", B5) +1, SEARCH(" ", B5, SEARCH(" ", B5)+1) - SEARCH(" ", B5)-1)

A screenshot of the formula used to split the middle name from a full name into a separate column

3. 若要取得名,於 F5 輸入下方公式並按 Enter,然後選取結果儲存格,向右拖曳自動填滿控點至所需儲存格。

=RIGHT(B5,LEN(B5) - SEARCH(" ",B5, SEARCH(" ",B5,1)+1))

A screenshot of the formula used to split the last name from a full name into a separate column

3) 使用強大工具將全名分割為姓、中間名與名

這裡介紹 Kutools for Excel 的「分割姓名 」功能,讓您只需幾個步驟即可將全名分割為姓、中間名與名。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

1. 選取欲分割的全名儲存格,然後點選 Kutools > 合併與分割 > 分割姓名

2. 在「分割姓名」對話框中,請依下列方式設定。

2.1) 選取區域會顯示於「分割區域」欄位,您可依需求更改;
2.2) 在「分割類型」區段,勾選 「姓」「中間名字」 「名」方塊;
2.2) 點選「確定」按鈕。

A screenshot of the Split Names dialog box where the first, middle, and last names are selected to be split

3. 在下一個彈出的「分割姓名」對話框中,選擇目的儲存格以輸出分割後文字,然後點選「確定」。請參考下方示範。

A GIF showing the Split Names feature in Kutools for Excel splitting full names into first, middle, and last names

Kutools for Excel - 超過 300 種必備工具,讓 Excel 功能更強大。永久免費享受 AI 功能!立即獲取

範例 #8 分割儲存格中的文字與數字

假設有一份混合文字與數字的字串清單,如下圖所示,若要將文字與數字分開並放入不同欄位,這裡提供四種方法供您參考。

A screenshot showing a list of text strings containing both text and numbers

使用公式分割文字與數字

可利用下列公式,將一個儲存格中的文字與數字分別拆分到兩個儲存格。

通用公式

取得儲存格中的文字

=LEFT(cell,MIN(FIND({0,1,2,3,4,5,6,7,8,9},cell&"0123456789"))-1)

取得儲存格中的數字

=RIGHT(cell,LEN(B5)-MIN(FIND({0,1,2,3,4,5,6,7,8,9},cell&"0123456789"))+1)

請將上述兩個公式分別套用於不同儲存格,即可取得分離的文字與數字。

1. 選取空白儲存格以放置清單中第一個字串的文字,複製或輸入下方公式並按 Enter 鍵。選取結果儲存格,向下拖曳自動填滿控點以取得清單中其他字串的文字。

=LEFT(B5,MIN(FIND({0,1,2,3,4,5,6,7,8,9},B5&"0123456789"))-1)

A screenshot showing the formula to extract text from a cell in Excel

2. 在第一個結果儲存格(D5)旁的 E5 儲存格中,複製或輸入下方公式並按 Enter。選取結果儲存格,向下拖曳自動填滿控點以取得清單中其他字串的數字。

=RIGHT(B5,LEN(B5)-MIN(FIND({0,1,2,3,4,5,6,7,8,9},B5&"0123456789"))+1)

A screenshot showing the formula to extract numbers from a cell in Excel

使用快速填滿(2013及更新版本)分割文字與數字

若您使用的是 Excel2013 或更新版本,可利用內建的快速填滿功能,將一個儲存格中的文字與數字分割到兩個欄位。

備註:為使快速填滿功能正常運作,需將結果欄位放在原始字串欄位旁。例如原始字串在 B 欄,分離的文字與數字應放在 C 與 D 欄。請參考下圖:

A screenshot showing Excel's Flash Fill feature being used to split text and numbers into columns

1. 在 C5 輸入第一個字串儲存格(D5)的文字。

2. 在 C6 輸入第二個字串儲存格(D6)的文字。

A screenshot showing manually typing the first example of split text in Excel

3. 啟用 C7 儲存格,點選「資料」>「 快速填滿」。

A screenshot showing the Flash Fill option in Excel

此時,其他字串的文字會自動填入儲存格,如下圖所示。

A screenshot showing text filled automatically in Excel using Flash Fill

4. 重複步驟1 至3以取得 D 欄的數字。

A screenshot showing the split numbers filled automatically in Excel using Flash Fill

注意事項

1) 若您的字串不規則,可能會產生錯誤值。可按 Ctrl + Z 撤銷快速填滿,改用其他方法。
2) 若快速填滿無法運作,請點選「檔案」>「選項」。於Excel 選項視窗左側點選「進階」,在「編輯選項」區段勾選「自動」快速填滿,然後點選「確定」

A screenshot showing how to enable the Flash Fill feature in Excel options

使用自訂函數分割文字與數字

若清單中的字串不規則,上述兩種方法可能會產生錯誤結果,如下圖所示。

A screenshot showing incorrect results from using Flash Fill in Excel with irregular data

這裡介紹自訂函數,無論數字位於字串何處,都能將文字與數字分割到兩個欄位。請參考下圖:

A screenshot showing correct results using a user-defined function in Excel to split text and numbers

1. 按下 Alt + F11

2. 在開啟的 Microsoft Visual Basic for Applications 視窗中,點選「插入」>「模組」,然後將下方 VBA 貼入程式碼視窗。

VBA 程式碼:將儲存格中的文字與數字分割到兩個欄位

Public Function SplitText(pWorkRng As Range, pIsNumber As Boolean) As String
'Update by Extendoffice 20211105
Dim xLen As Long
Dim xStr As String
xLen = VBA.Len(pWorkRng.Value)
For i = 1 To xLen
    xStr = VBA.Mid(pWorkRng.Value, i, 1)
    If ((VBA.IsNumeric(xStr) And pIsNumber) Or (Not (VBA.IsNumeric(xStr)) And Not (pIsNumber))) Then
        SplitText = SplitText + xStr
    End If
Next
End Function

A screenshot showing the Microsoft Visual Basic for Applications window

3. 按下 Alt + Q 關閉 Microsoft Visual Basic for Applications 視窗。

4. 選取儲存格以輸出清單中第一個字串的文字,輸入下方公式並按 Enter 鍵。選取此結果儲存格,向下拖曳自動填滿控點以取得清單中其他字串的文字。

=SplitText(B5,FALSE)

A screenshot showing the formula used to extract text using a user-defined function in Excel

5. 在第一個文字結果儲存格旁選取儲存格以輸出數字,輸入下方公式並按 Enter 鍵。選取此結果儲存格,向下拖曳自動填滿控點以取得其他字串的數字。

=SplitText(B5,TRUE)

A screenshot showing the formula used to extract numbers using a user-defined function in Excel

使用強大工具分割文字與數字

這裡推薦最簡單的方法,僅需幾個步驟即可將儲存格中的文字與數字同時分割到兩個欄位。套用 Kutools for Excel 的「分割儲存格」功能即可輕鬆完成。

1. 選取欲分割文字與數字的儲存格。

2. 點選 Kutools > 合併與分割 > 分割儲存格

3. 在「分割儲存格」對話框中,請進行以下設定。

3.1) 選取區域會顯示於 分割區域 欄位,您可點選 Range selection button 按鈕以依需求選取新區域;
3.2) 在「類型」區段,選擇「分割至多行」或「資料分欄」;
3.3) 在「分隔依據」區段,選擇「拆分為文本和數字」單選鈕;
3.4) 點選「確定」按鈕。

A screenshot showing the Split Cells dialog box settings

4. 在下一個「分割儲存格」對話框中,選擇要輸出分割後文字與數字的儲存格,然後點選「確定」。

此時,選取儲存格中的文字與數字會同時分割為兩個欄位,如下圖所示。

A screenshot showing the result after splitting text and numbers into two columns in Excel using Kutools

Kutools for Excel - 超過 300 種必備工具,讓 Excel 功能更強大。永久免費享受 AI 功能!立即獲取


2. 分割數字儲存格

本部分說明如何在兩種情境下分割數字儲存格:將多位數字分割為個別位數,以及依小數點分割數字以分離整數與小數部分。

範例 #1:依數字位數分割儲存格

若想將多位數字分割為不同欄位的個別位數,可嘗試下列任一方法。

A screenshot showing the method of splitting a number into individual digits in Excel with multiple columns

使用公式將儲存格中的數字分割為個別位數

下方公式可協助您將數字分割為個別位數並分別放入不同欄位。

通用公式

=MID($A1, COLUMNS($A$1:A$1),1)

參數說明

A1:代表您要分割為個別位數的數字儲存格。

1. 選取空白儲存格以輸出第一個位數,輸入下方公式並按 Enter 鍵。

=MID($B3, COLUMNS($B$3:B$3),1)

2. 選取此結果儲存格,向右拖曳自動填滿控點取得其他位數。保持所有結果儲存格選取狀態,再向下拖曳自動填滿控點以取得其他數字的個別位數。

A screenshot showing the result of splitting a number into individual digits in Excel

備註:此公式中的 B3 為欲分割為個別位數的數字儲存格,可依需求更改。

使用 VBA 將儲存格中的數字分割為個別位數

下方 VBA 程式碼同樣可協助您在 Excel 中將儲存格中的數字分割為個別位數。請依下列步驟操作。

1. 按下 Alt + F11 開啟 Microsoft Visual Basic for Applications 視窗。

2. 在 Microsoft Visual Basic for Applications 視窗中,點選「插入」>「模組」,然後將下方 VBA 貼入程式碼視窗。

VBA 程式碼:在 Excel 中將數字分割為個別位數

Sub SplitNumberIntoDigits()
'Updateby Extendoffice 2021118
Dim Rng As Range
Dim InputRng As Range, OutRng As Range
xTitleId = "Kutools for Excel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
 xInt = InputRng.Row

Application.ScreenUpdating = False

For Each Rng In InputRng
    xValue = Rng.Value
    xRow = (Rng.Row - xInt) + 1
    For I = 1 To VBA.Len(xValue)
        OutRng.Cells(xRow, I).Value = VBA.Mid(xValue, I, 1)
    Next
Next
Application.ScreenUpdating = True
End Sub

A screenshot of the Microsoft Visual Basic for Applications window showing VBA code for splitting numbers into individual digits

3. 按下 F5 執行程式碼,會跳出 Kutools for Excel 對話框,請選取欲分割的數字儲存格範圍,然後點選「確定」。

A screenshot of the Kutools for Excel dialog box used to select a range of number cells to split

4. 第二個 Kutools for Excel 對話框跳出後,請選取儲存格以輸出個別位數,然後點選「確定」。

A screenshot of the Kutools for Excel dialog box used to select the cell for output when splitting number cells into digits

備註:此程式碼亦可將單詞分割為個別字母。

此時,選取儲存格中的數字會分割為個別位數並分別放入不同欄位。

A screenshot showing the result of splitting number cells into individual digits using Kutools

輕鬆使用強大工具將數字分割為個別位數

Kutools for Excel 的「 分割儲存格」功能是協助您輕鬆將數字分割為個別位數的便捷工具。

1. 安裝 Kutools for Excel 後,選取欲分割的數字儲存格範圍,點選 Kutools > 合併與分割 > 分割儲存格

2. 在「分割儲存格」對話框中,請進行下列設定。

2.1) 在 分割區域 區段,可看到選取範圍顯示於文字框。您可點選 Range selection button 按鈕依需求更改範圍;
2.2) 在「類型」區段,依需求選擇「 分割至多行」或「資料分欄」;
2.3) 在「分隔依據」區段,選擇「指定寬度」單選鈕,並於文字框輸入數字1
2.4) 點選「確定」按鈕。

A screenshot of the Split Cells dialog box with the option to split cells into rows or columns

3. 在開啟的「分割儲存格」對話框中,選取空白儲存格以輸出位數,然後點選「確定」。

A screenshot of the Split Cells dialog box with the output destination for individual digitsb

此時,選取儲存格中的數字會立即分割為個別位數。

Kutools for Excel - 超過 300 種必備工具,讓 Excel 功能更強大。永久免費享受 AI 功能!立即獲取

範例 #2依小數點分割數字

本節說明在 Excel 中將數字分割為整數與小數部分的多種方法。

A screenshot of a sample table showing number cells to split at decimals

使用公式依小數點分割數字

可套用 TRUNC 函數,將數字依小數點分割。請依下列步驟操作。

通用公式

取得整數部分

=TRUNC(A1)

取得小數部分

=A1-TRUNC(A1)

參數說明

A1:代表您要依小數點分割的儲存格。

此時可分別套用上述兩個公式,將指定範圍內的數字依小數點分割。

1. 選取儲存格以放置第一個數字儲存格的整數部分,輸入下方公式並按 Enter 鍵。選取結果儲存格,向下拖曳自動填滿控點以取得其他數字儲存格的整數部分。

=TRUNC(B5)

A screenshot of the result after splitting a number into integer portion using the TRUNC function

2. 在第一個結果儲存格旁選取儲存格以放置小數部分,輸入下方公式並按 Enter 鍵。選取此結果儲存格,向下拖曳自動填滿控點以取得其他數字儲存格的小數部分。

=B5-TRUNC(B5)

A screenshot of the result after splitting a number into decimal portion using the TRUNC function

使用資料分欄依小數點分割數字

可套用資料分欄功能,將數字依小數點分割。

1. 選取欲依小數點分割的數字儲存格範圍,然後點選「資料」 「資料分欄」

2. 在「文字分欄精靈 –3 步驟之第1 步」對話框中,選擇「分隔符號」單選鈕並點選「下一步」。

A screenshot of the 'Step 1 of 3' dialog box of the Text to Columns feature in Excel, with the 'Delimited' radio button selected

3. 在「 第2 步」對話框中,僅勾選「其他」方塊,於文字框輸入「.」,然後點選「下一步」。

A screenshot of the 'Step 2 of 3' dialog box of the Text to Columns feature in Excel, with the 'Other' checkbox selected and a dot entered

4. 在 第3 步 對話框中,點選 Range selection button 按鈕以選擇目的儲存格以輸出分割後的整數與小數部分,最後點選 完成 按鈕。請參考下圖:

A screenshot of the 'Step 3 of 3' dialog box of the Text to Columns feature in Excel, with the destination cell selected

此時可看到選取儲存格中的整數與小數部分已分割,如下圖所示。但小數部分會遺失負號,這可能對使用者很重要。

A screenshot of the result after splitting a number into integer and decimal parts using Text to Columns, showing a negative decimal issue

使用快速填滿(2013及更新版本)依小數點分割數字

前述範例已介紹如何利用 快速填滿分割儲存格中的文字與數字,這裡同樣可用此方法依小數點分割數字。

1. 輸入幾個範例。本例於 C5 輸入 B5 的整數部分,C6 輸入 B6 的整數部分。請參考下圖:

備註:若為負數,請勿忘記輸入負號。

A screenshot of the Flash Fill method being applied to extract the integer portion of a number in Excel

3. 選取欲填入的欄位(包含範例),點選「資料」>「 快速填滿」。

A screenshot of the Flash Fill option in Excel

此時,指定數字儲存格的整數部分已成功提取,如下圖所示。

A screenshot showing the extracted integer portion after using Flash Fill on number cells in Excel

4. 重複上述步驟以分割同一數字儲存格的小數部分。

A screenshot showing the extracted decimal portion after using Flash Fill on number cells in Excel


3. 分割日期儲存格

另一常見情境為分割日期儲存格。若需將日期儲存格分割為日、月、年,或將日期儲存格分割為日期與時間,請依需求選擇下列解決方案。

範例 #1 將日期儲存格分割為日、月與年

假設您有一份 B5:B9 區域的日期清單,想將每個日期值分割為三個欄位(分別為日、月、年)。這裡提供三種方法協助您完成日期分割。

A screenshot of a list of date cells in Excel, showing an example of date values in column B5:B9

使用公式將日期儲存格分割為日、月與年

可分別套用 DATEMONTHYEAR 函數的三個公式,將日期分割為日、月、年。

通用公式

=DATE(A1)

=MONTH(A1)

=YEAR(A1)

參數說明

A1:代表您要分割為日、月、年的日期儲存格。

1. 建立三個欄位以放置分離的日、月、年。

2. 在「日」欄的第一個儲存格輸入下方公式並按 Enter 鍵,以取得第一個日期儲存格(B5)的日。選取結果儲存格,向下拖曳自動填滿控點以取得其他日期儲存格的日。

=DAY(B5)

A screenshot of a formula in Excel to extract the day from a date, using the DAY function in the Day column

3.依步驟1 的方式,於「」與「」欄分別套用下列公式,取得日期儲存格的月與年。

取得日期的月

=MONTH(B5)

A screenshot of a formula in Excel to extract the month from a date, using the MONTH function in the Month column

取得日期的年

=YEAR(B5)

A screenshot of a formula in Excel to extract the year from a date, using the YEAR function in the Year column

使用資料分欄將日期儲存格分割為日、月與年

依上述步驟套用資料分欄功能 將日期儲存格分割為日、月與年

備註:於 第2 步對話框中,僅勾選「其他」方塊,並於文字框輸入「/」。

A screenshot of the 'Text to Columns' dialog box in Excel, with the 'Other' option checked and a slash (/) symbol entered to split date cells

使用強大工具將日期儲存格分割為日、月與年

下方示範說明如何利用 Kutools for Excel 的「分割儲存格」功能,將日期分割為月、日、年。

Kutools for Excel 提供超過 300 種進階功能,簡化複雜任務,提升創造力與效率。 結合 AI 能力,Kutools 能夠精準自動化任務,讓數據管理變得輕而易舉。Kutools for Excel 的詳細資訊...免費試用...

此功能可協助您僅需幾個步驟即可批次分割日期。

點此瞭解更多此功能資訊。

A screenshot of a gif showing the Split Cells feature, splitting date cells into day, month, and year

Kutools for Excel - 超過 300 種必備工具,讓 Excel 功能更強大。永久免費享受 AI 功能!立即獲取

範例 #2 分割儲存格中的日期與時間

假設 B5:B9 區域有一份日期時間清單,若要將日期與時間分割為不同欄位,本節將介紹多種方法協助您完成。

A screenshot of a list of date-time cells in Excel, showing examples of dates and times in column B5:B9

使用公式分割儲存格中的日期與時間

可套用下列公式,將日期與時間分割為不同欄位。

1. 建立兩個欄位以放置日期與時間。

2.需將日期欄儲存格設為日期格式,時間欄儲存格設為時間格式。

1) 選取日期範圍,右鍵選擇「設定儲存格格式」。於「設定儲存格格式」對話框中,於「分類」方塊選擇「日期」,於「類型」方塊選擇所需日期格式,然後點選「確定」儲存變更。

A screenshot of the Format Cells dialog box in Excel, with the Date category selected to format a date column

2) 選取時間範圍,右鍵選擇 「設定儲存格格式」。於 「設定儲存格格式」對話框中,於「分類」方塊選擇「時間」,於「類型」方塊選擇所需時間格式,然後點選「確定」儲存變更。

A screenshot of the Format Cells dialog box in Excel, with the Time category selected to format a time column

3. 在「日期」欄的第一個儲存格輸入下方公式並按 Enter 鍵,以取得 B5 的日期。選取結果儲存格,向下拖曳自動填滿控點以取得其他日期。

=INT(B5)

A screenshot of an Excel formula to extract the date portion from a date-time value, using the INT function

4. 在時間欄套用下列公式,以取得 B5:B9 的時間。

=B5-D5

A screenshot of an Excel formula to extract the time portion from a date-time value, using the formula =B5-D5

使用快速填滿(2013及更新版本)分割儲存格中的日期與時間

若您使用的是 Excel2013 或更新版本,可利用內建的快速填滿功能,將日期與時間分割為不同欄位。

1. 建立「日期」與「時間」欄,並輸入幾個範例作為輸出。在「日期」欄輸入 B5 的日期於 C5,B6 的日期於 C6;在「時間」欄輸入 B5 的時間於 D5,B6 的時間於 D6。請參考下圖:

A screenshot showing examples of date and time values entered manually in Excel columns for Flash Fill to split them

2. 選取欲填入的「日期」欄(包含範例),點選「資料」>「 快速填滿」。

3. 選取欲填入的「時間」欄(包含範例),同樣啟用快速填滿功能。此時,B5:B9 的日期與時間會分割為不同欄位,如下方示範。

A screenshot of a gif demonstrating Excel's Flash Fill feature automatically splitting date and time values into separate columns

現在,您已學會在 Excel 中依不同情境以多種方法分割儲存格。您可根據實際需求選擇最適合的解決方案。

最佳 Office 辦公效率工具

🤖 Kutools AI Aide:徹底革新數據分析,基於智能執行|生成程式碼|創建自訂公式|分析數據並生成圖表|調用 Kutools Functions
熱門功能查找、選取項目的背景色或標記重複值 | 刪除空行 | 合併列或單元格且不丟失資料 | 四捨五入...
高級 LOOKUP多條件查找|多值查找|多表查找|模糊查找...
高級下拉列表快速創建下拉列表 | 關聯下拉列表 | 多選下拉列表 ...
列管理器添加指定數量的列 | 移動列 | 切換隱藏列的可見狀態 | 區域與列比較 ...
精選功能網格聚焦 | 設計檢視 | 增強編輯欄 | 工作簿及工作表管理器 | 資源庫 (自動文本) | 日期提取器 | 合併資料 | 加密/解密儲存格 | 按清單發送電子郵件 | 超級篩選 | 特殊篩選(篩選粗體/傾斜/刪除線 ...)...
前15 大工具集12 款文本工具添加文本刪除特定字符,...)|50+ 種圖表 類型甘特圖,...)|40+ 實用 公式基於生日計算年齡,...)|19 款插入工具插入QR码按路徑插入圖片,...)|12 款轉換工具金額轉大寫匯率轉換,...)|7 款合併和分割工具高級合併行分割儲存格,...)| ...以及更多
使用 Kutools 支援你的語言——支援英語、西班牙語、德語、法語、中文及40 多種語言!

利用 Kutools for Excel 大幅提升你的 Excel 技能,感受前所未有的高效體驗。 Kutools for Excel 提供超過300 項高級功能,助你提升效率並保存時間。 點此查看你最需要的功能...


Office Tab 為 Office 帶來標籤式介面,讓你的工作更加輕鬆

  • 啟用 Word、Excel、PowerPoint 的標籤式編輯和閱讀功能
  • 在同一個視窗的標籤中打開和創建多個文件,而不是在新窗口中分開開啟。
  • 可提升你50% 的工作效率,每天為你大量減少滑鼠點擊次數!