跳至主要内容

如何在 Excel 中快速将地址列表从行转置为列?

Author: Sun Last Modified: 2025-05-07

例如,您有一个包含姓名和地址的单个列表,需要将其转换为列,如下方截图所示。Excel 没有内置函数来实现此功能,但本文介绍了一些快速解决方法。
A screenshot showing an address list transposed from rows to columns in Excel

通过 VBA 转置地址列表

通过 Kutools for Excel 转置地址列表good idea3


通过 VBA 转置地址列表

要将地址列表从行转置为列,可以应用 VBA 代码。

1. 打开包含要转置数据的工作表,并按 Alt + F11 键打开 Microsoft Visual Basic for Applications 窗口。

2. 单击 插入 > 模块,并将以下宏代码粘贴到模块中。参见截图:

VBA:转置地址列表

Sub fixText()
'UpdatebyExtendoffice0170905
    Dim I As Integer
    Dim K As Integer
    Dim xRgS As Range
    Dim xRgD As Range
    Dim xAddress As String
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRgS = Application.InputBox("Select a range to transpose:", "KuTools For Excel", xAddress, , , , , 8)
    If xRgS Is Nothing Then Exit Sub
    Set xRgD = Application.InputBox("Select a cell to place result", "KuTools For Excel", , , , , , 8)
    If xRgD Is Nothing Then Exit Sub
    xRgD(1).Offset(, 0).Value = "Name"
    xRgD(1).Offset(, 1).Value = "Address"
    xRgD(1).Offset(, 2).Value = "City/State"
    K = 1
    For I = 1 To xRgS.Rows.Count
        xRgD(1).Offset(K).Value = xRgS(I).Value
        xRgD(1).Offset(K, 1).Value = xRgS(I + 1).Value
        xRgD(1).Offset(K, 2).Value = xRgS(I + 2).Value
        K = K + 1
        I = I + 2
    Next
End Sub

A screenshot of the VBA editor with the pasted macro code

3. 按 F5 键运行代码,弹出一个对话框,提醒您选择要使用的数据区域。参见截图:
A screenshot of the dialog for selecting the range to transpose in Excel

4. 单击 确定,然后在下一个弹出的对话框中,选择一个单元格以放置转置结果。参见截图:
A screenshot of the dialog for selecting a cell to place the transposed result

5. 单击 确定。现在,单个列表已转置为列。
A screenshot showing an address list transposed from rows to columns


通过 Kutools for Excel 转置地址列表

如果您安装了 Kutools for Excel,您可以应用“ 转换区域”功能快速将地址列表转置为列。

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

1. 选择要转置的数据,单击 Kutools > 区域 > 转换区域。参见截图:
A screenshot showing the Transform Range option in Kutools tab in Excel

2. 在弹出的对话框中,勾选 单列转区域 选项在 转换类型 部分,并勾选 固定值 选项并在右侧文本框中输入所需的数字。参见截图:
A screenshot of the Transform Range dialog with options to transpose data from a single column to a range

3. 单击 确定,并选择一个单元格以放置转置结果。参见截图:
A screenshot of the Kutools dialog for selecting a cell to place the transposed result

4. 单击 确定。地址列表已被转置。
A screenshot showing an address list transposed from rows to columns

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

演示:通过 Kutools for Excel 转置地址列表

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

最佳办公效率工具

🤖 Kutools AI 助手:基于智能执行生成代码创建自定义公式分析数据并生成图表调用 Kutools 函数等功能,彻底改变数据分析方式…
热门功能查找、高亮或标记重复项 | 删除空行 | 合并不丢失数据的列或单元格 | 四舍五入 ...
高级 LOOKUP多条件 VLookup | 多值 VLookup | 多表查找 | 模糊查找 ....
高级下拉列表快速创建下拉列表 | 从属下拉列表 | 多选下拉列表 ....
列管理器添加指定数量的列 | 移动列 | 切换隐藏列的可见状态 | 比较区域和列 ...
精选功能网格聚焦 | 设计视图 | 增强编辑栏 | 工作簿与工作表管理器 | 资源库(自动文本) | 日期提取 | 合并数据 | 加密/解密单元格 | 按列表发送电子邮件 | 超级筛选 | 特殊筛选(筛选粗体/斜体/删除线...)...
排名前 15 的工具集12 种文本 工具添加文本删除特定字符等) | 50 多 种图表 类型甘特图等) | 40 多种实用 公式基于生日计算年龄等) | 19 种插入 工具插入二维码根据路径插入图片等) | 12 种转换 工具小写金额转大写汇率转换等) | 7 种合并与分割 工具高级合并行分割单元格等) | 还有更多...

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


Office Tab 将标签式界面引入 Office,让您的工作更加轻松

  • 在 Word、Excel、PowerPoint 中启用标签式编辑和阅读
  • 在同一窗口的新标签页中打开和创建多个文档,而不是在新窗口中进行操作。
  • 将您的生产力提升 50%,每天为您减少数百次鼠标点击!