提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何快速堆积多列到Excel中的一列?

在Excel中,Text to columns函数可以基于分隔符将单元格分割为多个列,但是如果有任何方法将多个列堆叠到一列中,如下面的屏幕截图所示? 在本文中,我将介绍一些快速解决此任务的技巧。
doc堆列到一个1

使用公式将多个列堆叠成一个列

使用VBA将多个列堆叠成一个列

使用变换范围将多个列堆叠到一个列中 好idea3

Office选项卡在Office中启用选项卡式编辑和浏览,使您的工作更轻松......
Kutools for Excel - 最佳办公生产力工具将解决您的大部分Excel问题
  • 重用任何东西: 将最常用或最复杂的公式,图表和其他任何内容添加到您的收藏夹中,并在将来快速重复使用它们。
  • 超过20文本功能: 从文本字符串中提取数字; 提取或删除部分文本; 将数字和货币转换为英语单词...
  • 合并工具:多个工作簿和表格合二为一; 合并多个单元格/行/列而不丢失数据; 合并重复行和总和...
  • 拆分工具:根据价值将数据拆分为多个表格; 一个工作簿到多个Excel,PDF或CSV文件; 一列到多列......
  • 粘贴跳过 隐藏/过滤行; 数和总和 按背景颜色; 创建邮件列表和 通过Cell的价值发送电子邮件...
  • 超级过滤器: 创建高级过滤方案并应用于任何工作表; 排序 按周,日,频率等; 筛选 通过大胆,公式,评论......
  • 超过300强大的功能; 适用于Office 2007-2019和365; 支持所有语言; 在公司轻松部署; 全功能60天免费试用。

使用公式将多个列堆叠成一个列


1。 选择您想要堆叠的范围,然后转到 名称框 给这个范围一个名字,然后按 输入 键。 看截图:
doc堆列到一个2

2。 然后选择一个您想放置结果的空白单元格,输入此公式 =INDEX(MyData,1+INT((ROW(A1)-1)/COLUMNS(MyData)),MOD(ROW(A1)-1+COLUMNS(MyData),COLUMNS(MyData))+1), 按 恩特r键并向下拖动填充手柄直到显示错误。 看截图:
doc堆列到一个3

在公式中,MyData是您在步骤1中指定的范围名称。

使用VBA将多个列堆叠成一个列

这是一个可以帮助你的VBA代码。

1。 按 Alt + F11键 键显示 Microsoft Visual Basic for Applications 窗口。

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

VBA:将列堆叠到一个

Sub ConvertRangeToColumn()
'UpdatebyExtendoffice
Dim Range1 As Range, Range2 As Range, Rng As Range
Dim rowIndex As Integer
xTitleId = "KutoolsforExcel"
Set Range1 = Application.Selection
Set Range1 = Application.InputBox("Source Ranges:", xTitleId, Range1.Address, Type:=8)
Set Range2 = Application.InputBox("Convert to (single cell):", xTitleId, Type:=8)
rowIndex = 0
Application.ScreenUpdating = False
For Each Rng In Range1.Rows
    Rng.Copy
    Range2.Offset(rowIndex, 0).PasteSpecial Paste:=xlPasteAll, Transpose:=True
    rowIndex = rowIndex + Rng.Columns.Count
Next
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

doc堆列到一个4

3。 按 F5 键来运行代码,弹出一个对话框来选择源数据,然后单击 OK,选择一个单元格来放置结果。 看截图:
doc堆列到一个5

4。 点击 OK。 现在这些列已经堆积在一列中。
doc堆列到一个6


使用变换范围将多个列堆叠到一个列中

申请 Kutools for Excel变换范围 实用工具也可以帮助你快速解决这个问题。

Kutools for Excel, 与超过 300 方便的功能,让您的工作更轻松。

安装后 Kutools for Excel,请按照以下步骤操作:(免费下载Kutools for Excel!)

安装后 Kutools为Excel,请做如下:(免费下载Kutools for Excel!)

1。 选择您使用的列数据,然后单击 Kutools > Range > 变换范围。 看截图:
doc堆列到一个8

2。 在里面 变换范围 对话框,检查 范围为单列 选项,然后单击 Ok,然后选择一个单元格来放置结果。 看截图:
doc堆列到一个9

3。 点击 OK。 现在这些列已经被堆叠成一个列。
doc堆列到一个1


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Susan Millard · 3 months ago
    I am using the Stack Multiple Columns Into One With Formula method and it worked perfectly, but I want it to maintain the formatting, i.e. some columns were bold & 1 was hyperlinks. Is there something that can be added to the formula to make this happen?
    • To post as a guest, your comment is unpublished.
      Sunny · 1 months ago
      Hi, Susan Milard, their formula can meet your need, you can use the VBA or the Transpose Range tool,both of them can satisfy you.
  • To post as a guest, your comment is unpublished.
    Tom · 6 months ago
    I am attempting to do this over a very large table (100s of columns and rows that are all linked to formulas. My excel will keep loading and then ultimately go to not responding. Is there a way to get past this? Thanks
    • To post as a guest, your comment is unpublished.
      Sunny · 4 months ago
      Hi, Tom, which method you apply does not work? The method three, transform range tool must can work.
  • To post as a guest, your comment is unpublished.
    Chris Blackburn · 7 months ago
    Hi, I'm looking to go a step further with this. I've used Stack Multiple Columns Into One With VBA, code and this works. I've used Tables as the source with this code and I get the list. Is there a way to automate running the Macro? So that when I add a new entry into the table the Macro automatically runs and keeps the resulting list up to date?
    • To post as a guest, your comment is unpublished.
      Sunny · 6 months ago
      Hi, Chris Blackburn, sorry I am affraid I cannot find a code can automatically run to update the result, maybe someone else can.
  • To post as a guest, your comment is unpublished.
    tom · 1 years ago
    Hi, is there a way to make the formula ignore any blank cells your data may contain?


    =INDEX(MyData,1+INT((ROW(A1)-1)/COLUMNS(MyData)),MOD(ROW(A1)-1+COLUMNS(MyData),COLUMNS(MyData))+1),


    I am using a helper sheet to create a contiguous list for a data validation drop down list. Thanks in advance.
    • To post as a guest, your comment is unpublished.
      Sunny · 11 months ago
      Sorry, I am not good at formula, maybe you can try to use Kutools for Excel's Select Nonblank cells utility to select the unempty cells firstly, and copy and paste them to another location, then use above methods.
  • To post as a guest, your comment is unpublished.
    Gokce · 1 years ago
    I have data which ends at the same row but multiple columns in which I want them to be stacked in a sequence where B column data will go under A column data where the data ends for A column and C column data to go under A column data where the data from B column ends and so on. This way I will have data from multiple columns to fit into one column. How can I do that?
  • To post as a guest, your comment is unpublished.
    badusha · 1 years ago
    Hello , is there any to convert above data to following form ??
    1
    A
    Lilly
    2
    B
    Judy
    ...
  • To post as a guest, your comment is unpublished.
    John Smith · 1 years ago
    this is just a clickbait to have you download a paying software
    • To post as a guest, your comment is unpublished.
      Sunny · 1 years ago
      The first download will be free to use in 60 days, after that, you can decide to pay for use or not.
  • To post as a guest, your comment is unpublished.
    Jon · 1 years ago
    you are stacking multiple rows into one column, not multiple columns... not what I was looking for.
    • To post as a guest, your comment is unpublished.
    • To post as a guest, your comment is unpublished.
      Phil · 1 years ago
      To stack columns A-P that are in blocks of 6 rows put this formulae in cell R1 and fill down

      =OFFSET($A$1,MOD(ROW()-ROW($R$1),ROWS($A$1:$A$6)),TRUNC((ROW()-ROW($R$1))/ROWS($A$1:$A$6)),1,1)
      • To post as a guest, your comment is unpublished.
        Miguel · 1 years ago
        Cancel that last one, missed the truncate step.
      • To post as a guest, your comment is unpublished.
        Miguel · 1 years ago
        Dang, now it doesn’t work! Tried on a new tab but it’s now back to stacking column contents in one in stead of originally row content.
      • To post as a guest, your comment is unpublished.
        Miguel · 1 years ago
        Thank you for posting this solution! In case anyone needs a space after/at the end of each block, just add an additional count to the rows, so going by the example above, instead of $A$6, write $A$7. It inputs a zero ‘0’ to the row but you can easily ‘Use selection for Find’ in Sublime to edit them out. If you know the solution which doesn’t add a zero, please post!?
        • To post as a guest, your comment is unpublished.
          Timkil · 10 months ago
          to output a blank cell instead of 0, do an IF function>0, TRUE-->output the original cell content, FALSE-->output ""

          =if(OFFSET($A$1,MOD(ROW()-ROW($R$1),ROWS($A$1:$A$6)),TRUNC((ROW()-ROW($R$1))/ROWS($A$1:$A$6)),1,1)>0,OFFSET($A$1,MOD(ROW()-ROW($R$1),ROWS($A$1:$A$6)),TRUNC((ROW()-ROW($R$1))/ROWS($A$1:$A$6)),1,1),"")
      • To post as a guest, your comment is unpublished.
        Fish · 1 years ago
        This works perfect, thanks