跳至主要内容

在 Excel 中将逗号分隔的值分割为行/列 - 简易指南

Author: Siluvia Last Modified: 2025-07-31

在某些情况下,您可能需要将选定单元格中的逗号分隔值分割为单独的行或列。本指南将探讨不同的有效方法,提供逐步说明,以确保您能够根据需要高效管理和重新组织数据。


将逗号分隔的值分割到不同的列中

要将选定单元格中的逗号分隔值分割到不同的列中,请尝试本节中的方法。

使用文本分栏向导将逗号分隔的值分割到列中

要将选定单元格中的逗号分隔值分割到列中,常用的方法是 Excel 中的文本分栏向导。在这里,我将逐步向您展示如何使用此向导来实现所需的结果。

1.选择要分割值到列的单元格区域,然后点击“数据”> “分栏”。查看截图:

A screenshot of selecting Text to Columns under the Data tab in Excel

2. 在第一个“转换文本到列向导”对话框中,选择“分隔符”选项,然后点击“下一步”按钮。

A screenshot of the Convert Text to Columns Wizard dialog box with the Delimited option selected

3. 在第二个“转换文本到列向导”对话框中,仅勾选“逗号”框中的“分隔符”部分,然后点击“下一步”按钮。

A screenshot of the second Convert Text to Columns Wizard dialog box with the Comma delimiter selected

4. 在最后一个“转换文本到列向导”对话框中,在“目标”框中选择一个单元格以定位分割值,最后点击“完成”按钮。

A screenshot of the final Convert Text to Columns Wizard dialog box to select the Destination cell

现在,选定单元格中用逗号分隔的所有值已分割到不同的列中,如下截图所示。

A screenshot showing comma-separated values split into multiple columns in Excel

使用 Kutools轻松将逗号分隔的值分割到多个列中

如您所见,“文本分栏”向导需要多个步骤来完成任务。如果您需要更简单的方法,强烈推荐使用“Kutools for Excel”的“分割单元格”功能。通过此功能,您可以方便地根据特定分隔符将单元格分割为多个列或行,只需在一个对话框中完成设置。

Kutools for Excel 提供了超过 300 种高级功能,简化复杂任务,提升创造力与效率。 通过集成 AI 能力,Kutools 能够精准自动执行任务,让数据管理变得轻松简单。Kutools for Excel 的详细信息...         免费试用...

安装 Kutools for Excel 后,选择“Kutools” > “合并与分割” > “分割单元格”以打开“分割单元格”对话框。

  1. 选择包含您希望分割的文本的单元格区域。
  2. 选择“分割至列”选项。
  3. 选择“逗号”(或您需要的任何分隔符)并点击“确定”。
    A screenshot of the Kutools Split Cells dialog box with Split to Columns selected and Comma as the delimiter
  4. 选择一个目标单元格并点击“确定”以获取所有分割数据。
    A GIF showing how to split cells into multiple columns using Kutools for Excel.
备注:要使用此功能,您应该在计算机上安装 Kutools for Excel。立即去下载 Kutools for Excel。

将逗号分隔的值分割到不同的行中

本节演示了两种方法,帮助您在 Excel 中将逗号分隔的值分割到不同的行中。请按以下步骤操作。

使用 VBA 将逗号分隔的值分割到多行中

要将逗号分隔的值分割到行中,您可以应用以下 VBA代码。

1. 同时按下“Alt” + “F11”键以打开“Microsoft Visual Basic for Applications”窗口。

2. 在“Microsoft Visual Basic for Applications”窗口中,点击“插入”>“模块”。然后将以下 VBA代码复制并粘贴到模块窗口中。

VBA代码:将逗号分隔的值分割到行中

Sub SplitAll()
	Dim xRg As Range
	Dim xRg1 As Range
	Dim xCell As Range
	Dim I As Long
	Dim xAddress As String
	Dim xUpdate As Boolean
	Dim xRet As Variant
	On Error Resume Next
	xAddress = Application.ActiveWindow.RangeSelection.Address
	Set xRg  = Application.InputBox("Please select a range", "Kutools for Excel", xAddress, , , , , 8)
	Set xRg  = Application.Intersect(xRg, xRg.Worksheet.UsedRange)
	If xRg Is Nothing Then Exit Sub
		If xRg.Columns.Count > 1 Then
			MsgBox "You can't select multiple columns", , "Kutools for Excel"
			Exit Sub
			End If
			Set xRg1 = Application.InputBox("Split to (single cell):", "Kutools for Excel", , , , , , 8)
			Set xRg1 = xRg1.Range("A1")
			If xRg1 Is Nothing Then Exit Sub
				xUpdate = Application.ScreenUpdating
				Application.ScreenUpdating = False
				For Each xCell In xRg
					xRet = Split(xCell.Value, ",")
					xRg1.Worksheet.Range(xRg1.Offset(I, 0), xRg1.Offset(I + UBound(xRet, 1), 0)) = Application.WorksheetFunction.Transpose(xRet)
					I = I + UBound(xRet, 1) + 1
				Next
				Application.ScreenUpdating = xUpdate
			End Sub

3. 按下“F5”键运行代码。在弹出的“Kutools for Excel”对话框中,选择您要分割的单元格,然后点击“确定”按钮。

A screenshot of selecting the range of cells for splitting using a VBA code in Excel

4. 在第二个弹出的“Kutools for Excel”对话框中,选择一个单元格以定位分割值,然后点击“确定”。

A screenshot of selecting the destination cell for the split data after running VBA code

然后您可以看到选定单元格中用逗号分隔的值已分割到行中,如下截图所示。

A screenshot showing comma-separated values split into multiple rows using VBA code

使用 Kutools for Excel轻松将逗号分隔的值分割到行中

VBA代码对于 Excel 新手来说太难以修改以满足他们的需求。在这里,“Kutools for Excel”的“分割单元格”功能也可以帮助轻松地将逗号分隔的值分割到 Excel 中的多行中。

Kutools for Excel 提供了超过 300 种高级功能,简化复杂任务,提升创造力与效率。 通过集成 AI 能力,Kutools 能够精准自动执行任务,让数据管理变得轻松简单。Kutools for Excel 的详细信息...         免费试用...

安装 Kutools for Excel 后,选择“Kutools” > “合并与分割” > “分割单元格”以打开“分割单元格”对话框。

  1. 选择包含您希望分割的逗号分隔值的单元格区域。
  2. 选择“分割至多行”选项。
  3. 选择“逗号”(或您需要的任何分隔符)并点击“确定”。
    A screenshot of the Kutools Split Cells dialog box with Split to Rows selected and Comma as the delimiter
  4. 选择一个目标单元格并点击“确定”以获取所有分割数据。
    A GIF showing how to split cells into multiple rows using Kutools for Excel
备注:要使用此功能,您应该在计算机上安装 Kutools for Excel。立即去下载 Kutools for Excel。

演示:使用 Kutools for Excel 快速将逗号分隔的值分割到行或列中

 
Kutools for Excel:超过 300 种实用工具触手可及!永久免费享受 AI 功能!立即下载!

最佳 Office 办公效率工具

🤖 Kutools AI 助手:基于智能执行,彻底革新数据分析 生成代码创建自定义公式分析数据并生成图表调用 Kutools Functions
热门功能:查找、选中项的背景色或标记重复项|删除空行|合并列或单元格且不丢失数据|四舍五入(无公式)...
高级 LOOKUP多条件查找 (VLookup)多值查找 (VLookup)多表查找 (VLookup Across Multiple Sheets)模糊查找 (Fuzzy Lookup)...
高级下拉列表快速创建下拉列表依赖型下拉列表多选下拉列表...
列管理器添加指定数量的列移动列切换隐藏列的可见状态比较区域及列...
特色功能网格聚焦设计视图增强编辑栏工作簿 & 工作表管理器资源库(自动文本)|日期提取合并数据加密/解密单元格按列表发送电子邮件超级筛选特殊筛选(筛选粗体/倾斜/删除线等)...
热门15 大工具集12 款文本工具添加文本删除特定字符等)50+ 种图表 类型甘特图等)40+ 实用公式基于生日计算年龄等)19 款插入工具插入二维码按路径插入图片等)12 种转换工具小写金额转大写汇率转换等)7 款合并与分割工具高级合并行分割单元格等)...更多精彩等你发现
使用 Kutools,支持您的首选语言——包括英语、西班牙语、德语、法语、中文及40 多种其他语言!

用 Kutools for Excel 加速你的 Excel 技能,体验前所未有的高效办公。 Kutools for Excel 提供300 多项高级功能,助您提升效率,节省大量时间。点击此处,获取你最需要的功能...


Office Tab 为 Office 带来标签式界面,让你的工作更加轻松

  • 在 Word、Excel、PowerPoint 启用标签式编辑和阅读
  • 在同一窗口的新标签中打开和创建多个文档,无需新建窗口。
  • 办公效率提升50%,每天帮你减少上百次鼠标点击!