跳到主要内容

如何通过回车将单元格分为多列或多行?

通常,在Excel中,我们可以使用“文本到列”功能根据某些特定字符(例如逗号,分号,点标记)将单元格内容快速拆分为多列。 但是,您是否曾经尝试通过回车符将单元格值分成多列或多行?

根据回车和“文本到列”将单元格分成多列

使用VBA代码根据回车符将单元格分成多行

使用 Kutools for Excel 根据回车符将单元格拆分为多列或多行

使用 Kutools for Excel 根据回车将多个单元格合并为一个单元格


箭头蓝色右气泡 根据回车和“文本到列”将单元格分成多列

如果您具有由回车符分隔的单元格内容列表,如下所示,则实际上是 文本到列 函数可以帮助您将单元格值分成多列。

doc由新行1分割

1。 选择要拆分其内容的单元格。

2。 点击 时间 > 文本到列,请参见屏幕截图:

doc由新行2分割

3。 在 将文本转换为列向导,检查 分隔 步骤1中的选项,请参见屏幕截图:

doc由新行3分割

4。 然后点击 下一页 按钮,在步骤2中,检查 其他名称 选项下 定界符,然后在旁边的框中 其他名称, 按 Ctrl + J 钥匙,请看截图:

doc由新行4分割

5。 然后点击 下一页 按钮,在步骤3中,选择 总类 选项,并指定用于定位结果的单元格,然后单击 完成 直接按一下按钮即可完成操作。

doc由新行5分割

6。 单元格内容已分为多列,如以下屏幕截图所示:

doc由新行6分割


箭头蓝色右气泡 使用VBA代码根据回车符将单元格分成多行

有时,您需要根据回车符将单元格值分成多行,如下面的屏幕截图所示。

doc由新行7分割

您没有直接的方法可以在Excel中处理此任务,但是您可以创建VBA代码来解决它。

1。 按住 ALT + F11 键,然后打开 Microsoft Visual Basic for Applications窗口.

2。 点击 插页 > 模块,然后将以下代码粘贴到 模块窗口.

VBA代码:根据回车符将单元格分成多行

Sub SplitCells()
'Update by Extendoffice
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
    lLFs = VBA.Len(Rng) - VBA.Len(VBA.Replace(Rng, vbLf, ""))
    If lLFs > 0 Then
        Rng.Offset(1, 0).Resize(lLFs).Insert shift:=xlShiftDown
        Rng.Resize(lLFs + 1).Value = Application.WorksheetFunction.Transpose(VBA.Split(Rng, vbLf))
    End If
Next
End Sub

3。 然后按 F5 键来运行此代码,然后会弹出一个提示框,提醒您选择要拆分的数据范围,请参见屏幕截图:

doc由新行8分割

4。 然后点击 OK,并且您选择的数据已根据回车符分为多行。


箭头蓝色右气泡 使用 Kutools for Excel 根据回车符将单元格拆分为多列或多行

Kutools for Excel分裂细胞 实用程序可以帮助您快速轻松地将单元格拆分为多列或多行。

Kutools for Excel : 带有300多个便捷的Excel加载项,可以在30天内免费试用. 

安装后 Kutools for Excel,请执行以下操作:

1。 选择要拆分的数据范围。

2。 点击 库工具 > 合并与拆分 > 分裂细胞,请参见屏幕截图:

3。 在 分裂细胞 对话框中,选择 拆分为行 or 拆分为列 选项下 Type 您需要的部分,然后检查 新队 在下面 指定分隔符 部分,请参见屏幕截图:

doc由新行10分割

4。 然后点击 OK 按钮,然后会弹出一个提示框,提醒您选择一个单元格以输出结果,请参见屏幕截图:

doc由新行11分割

5。 然后点击 OK,如果您选择 拆分为列 选项,所有选择的单元格值都已由回车符分成多列,请参见屏幕截图:

doc由新行12分割

如果你选择 拆分为行 选项,您选择的单元格值将被分成多行,如下图所示:

doc由新行13分割

单击以了解有关此“拆分单元格”实用程序的更多信息……

单击立即下载并免费试用 Kutools for Excel!


箭头蓝色右气泡 演示:根据回车和“文本到列”将单元格分成多列

Kutools for Excel:具有300多个方便的Excel加载项,可以在30天内免费试用,没有任何限制。 立即下载并免费试用!

箭头蓝色右气泡 使用 Kutools for Excel 根据回车将多个单元格合并为一个单元格

根据回车符将多个单元格合并为一个:

与上述内容相反,如何将多个用回车符分隔的单元格值组合到Excel中的一个单元格中? 在这里,我将讨论一个简单的工具-Kutools for Excel,其功能强大 结合 功能,您可以快速将多个行,列,单元格合并为一个单元格。

doc由新行14分割

Kutools for Excel:具有300多个方便的Excel加载项,可以在30天内免费试用,没有任何限制。 立即下载并免费试用!


箭头蓝色右气泡 演示:使用 Kutools for Excel 根据回车符将多个单元格合并为一个单元格

Kutools for Excel:具有300多个方便的Excel加载项,可以在30天内免费试用,没有任何限制。 立即下载并免费试用!

相关文章:

如何在Excel中将回车转换为逗号?

如何在Excel中快速删除换行符?

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (6)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have values in cell like "100/5" which is fetched by formula in one cell and would like to split the values in to two adjacent columns like "100" in one cell and "5" in another. Could you please suggest if I can do that with help of formula?
This comment was minimized by the moderator on the site
This is awesome.. very helpful.. Thank you so much.. :)
This comment was minimized by the moderator on the site
Hi, If this formula contains the option to insert instead directly split and paste in a transpose method, we do have range of rows, This option just split and transpose on existing data cells. If we get a option to insert and paste accordingly would be grateful otherwise the formula is very useful
This comment was minimized by the moderator on the site
This page has helped a lot, I used to VBA to separate the rows up. The problem that I have is that I have multiple columns. All the cells in the row either have one "row" or X number of "rows"of information in the other cells. If anyone knows how to do this it would be greatly appreciated.
This comment was minimized by the moderator on the site
[quote]This page has helped a lot, I used to VBA to separate the rows up. The problem that I have is that I have multiple columns. All the cells in the row either have one "row" or X number of "rows"of information in the other cells. If anyone knows how to do this it would be greatly appreciated.By Brian[/quote] Stephen Even i'm looking for multiple Column having Alt+Enter data needs to convert to multiple rows with same data , needs copy the entire data of next columns as well in the new row
This comment was minimized by the moderator on the site
Was looking for information like this and this page solved everything for me. Well done!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations