跳至主要内容

如何在Excel中将两列交替值合并为一列?

Author: Sun Last Modified: 2025-07-31

工作表中有两列。任务是将这两列合并为一列,并且值交替排列,如下方截图所示。你如何快速完成此任务而不用逐一手动重新排序呢?
A screenshot of two columns in Excel to be merged into one with alternating values

通过VBA代码将两列交替值合并为一列

通过Kutools for Excel将两列交替值合并为一列good idea3


通过VBA代码将两列交替值合并为一列

要将两列以交替值合并为一列,在Excel中除了使用VBA代码外,没有内置函数可以实现。

1. 按 Alt + F11 键打开 Microsoft Visual Basic for Applications 窗口。点击 插入 > 模块 创建一个新的空白模块。

2. 将以下代码复制并粘贴到模块中。

VBA:将两列以交替值合并为一列

Sub MergeColumns()
'UpdatebyExtendoffice20180815
Dim xSRg, xDRg As Range
Dim xDWS As Worksheet
Dim xIntDR, xIntDC, xI As Long
Dim xFNum As Long
On Error GoTo Err1
Set xSRg = Application.InputBox("Select two columns:", "Kutools for Excel", xTxt, , , , , 8)
If xSRg Is Nothing Then
Err1:
    Application.ScreenUpdating = True
    Exit Sub
End If
Set xDRg = Application.InputBox("Select a cell to place result:", "Kutools for Excel", xTxt, , , , , 8)
If xDRg Is Nothing Then
    Exit Sub
End If
Application.ScreenUpdating = False
Set xDWS = xDRg.Worksheet
xIntDR = xDRg.Row
xIntDC = xDRg.Column
xI = 0
    For xFNum = 1 To xSRg.Count
        Set xDRg = xDWS.Cells(xIntDR + xI, xIntDC)
        xDRg.Value = xSRg.Item(xFNum).Value
        xI = xI + 1
    Next xFNum
Application.ScreenUpdating = True
End Sub

3. 按下 F5 键,并在弹出的对话框中选择要合并的两列。
A screenshot showing the dialog for selecting two columns to merge

4. 点击 确定,在第二个对话框中,选择一个单元格放置结果。
A screenshot of the dialog for selecting a cell to place the merged result

5. 点击确定。现在,所选的两列已以交替值合并为一列。


通过 Kutools for Excel 将两列交替值合并为一列

如果你已在 Excel 中安装了 Kutools for Excel,其 转换区域 工具只需三个简单步骤即可完成此任务。

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

1. 选择要合并的列(两列或更多),点击 Kutools > 转换区域.
A screenshot showing the Kutools Transform Range option in Excel

2. 在 转换区域 对话框中,勾选 区域转单列 选项,并点击 确定.
A screenshot of the Transform Range dialog in Kutools with the Range to single column option selected

3. 在弹出的对话框中选择一个单元格放置结果。点击 确定.
A screenshot of the Kutools dialog for selecting a cell to place the merged result

现在,这些列已被合并为一列,并且值在两列之间交替排列。
A screenshot showing the final result of two columns merged into one with alternating values in Excel

Kutools for Excel - 通过超过300个必备工具,让Excel功能大幅提升。永久免费享受AI功能!立即获取

演示:使用 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%,每天帮你减少上百次鼠标点击!