跳到主要内容

如何将列和行转置/转换为单列?

当您使用Excel工作表时,有时会遇到此问题:如何将一系列数据转换或转置为单个列? (请参见以下屏幕截图:)现在,我为您介绍三个快速技巧来解决此问题。

用公式将列和行转置/转换为单列

使用VBA代码将列和行转置/转换为单列

使用 Kutools for Excel 转置/将列和行转换为单列好主意3


用公式将列和行转置/转换为单列

以下长公式可以帮助您快速将一系列数据转置为列,请按以下步骤操作:

1.首先,为您的数据范围定义一个范围名称,选择要转换的范围数据,右键单击并选择 定义名称 形成上下文菜单。 在里面 新名字 对话框中,输入所需的范围名称。 然后点击 OK。 看截图:

2.指定范围名称后,单击一个空白单元格,在本示例中,我将单击单元格E1,然后输入以下公式: =INDEX(MyData,1+INT((ROW(A1)-1)/COLUMNS(MyData)),MOD(ROW(A1)-1+COLUMNS(MyData),COLUMNS(MyData))+1).

备注: 我的数据 是所选数据的范围名称,您可以根据需要进行更改。

3.然后将公式向下拖动到单元格,直到显示错误信息。 该范围内的所有数据都已转置到单个列中。 看截图:


在Excel中快速将范围转置为列/行/反之亦然

在某些情况下,您可能需要将一系列单元格转置为一列或一行,反之亦然,将一列或一行转换为Excel工作表中的多行和多列。 您有任何快速的解决方法吗? 在这里 移调范围 功能 Kutools for Excel 可以轻松处理以上所有工作。点击即可获得 30 天的全功能免费试用!
doc1
 
Kutools for Excel:拥有300多个便捷的Excel加载项,可以在30天内免费试用。

使用VBA代码将列和行转置/转换为单列

使用以下VBA代码,您还可以将多列和多行连接为单列。

1.按住 ALT + F11 键打开 Microsoft Visual Basic应用程序 窗口。

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

Sub ConvertRangeToColumn()
'Updateby20131126
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

3。 按 F5 键运行代码,并显示一个对话框供您选择要转换的范围。 看截图:

4。 然后点击 Ok,然后会显示另一个对话框,以选择一个单格单元格以输出结果,请参见屏幕截图:

5.然后点击 Ok,然后将范围的单元格内容转换为列列表,请参见屏幕截图:

doc转换范围到列11


使用 Kutools for Excel 转置/将列和行转换为单列

也许公式记不清了,并且VBA代码对您有一些限制,在这种情况下,请不要担心,在这里,我将向您介绍一个更简单,更多功能的工具-Kutools for Excel,其 Transform Range 实用程序,您可以快速方便地解决此问题。

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

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

1.选择要移调的范围。

2。 点击 库工具 > Transform Range,请参见屏幕截图:

doc将范围转换为第12列

3.在 Transform Range 对话框中选择 Range to single column 选项,请参见屏幕截图:

doc将范围转换为第13列

4。 然后点击 OK,然后指定一个单元格以将结果从弹出框中输入。

doc将范围转换为第14列

5。 点击 OK,并且多列和多行数据已转置为一列。
doc将范围转换为第15列

如果要将列转换为具有固定行的范围,也可以使用 Transform Range 功能来快速处理它。
doc将范围转换为第16列


使用 Kutools for Excel 将交叉表转置为列表表

如果您需要将交叉表转换为列表表(如屏幕截图所示),除了逐一重新键入数据外,还可以使用 Kutools for ExcelTranspose Table Dimensions 实用程序,可在Excel中的交叉表和列表之间快速转换。
doc将范围转换为第19列

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

1.选择要转换为列表的交叉表,单击 库工具 > Range > Transpose Table Dimensions.
doc将范围转换为第18列

2。 在 Transpose Table Dimension 对话框,检查 Cross table to list 选项 Transpose type 部分中,选择一个单元格以放置新格式表。
doc将范围转换为第18列

3。 点击 Ok,现在交叉表已转换为列表。


相关文章:

如何在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 (58)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
thanks for the tutor, very helpfull
This comment was minimized by the moderator on the site
Wow! This is amazing! My data starts on A2 rather than A1 but when I change that in the formula it's grabbing B2 to start rather than A2. I've tried changing things up but can't seem to get it to work. Can you please LMK what I need to change in the formula? Thanks in advance and appreciate any advise!
This comment was minimized by the moderator on the site
Hello, Graves
Yes, as you said, the formula is not correct when the data starts from A2, in this case, you can apply the following formula:
=OFFSET(mydata,TRUNC((ROW()-ROW($G$1))/COLUMNS(mydata)),MOD(ROW()-ROW($G$1),COLUMNS(mydata)),1,1)

Note: In the above fromula, mydata is the range name of the selected data, G1 is the cell you enter this formula, please change them to your own.
Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Convert table to one column, ignore blank cell and duplicates value. How ?
This comment was minimized by the moderator on the site
After converting the table to a column, using Excel' Remove Duplicate feature to remove the duplicates, then select the column range, use the Delete Blank Rows of Kutools for Excel to remove the blank cells.
This comment was minimized by the moderator on the site
Thank you so much! :)
This comment was minimized by the moderator on the site
the data i am transposing to single column from rows have blanks in it how can i ignore them while transposing
This comment was minimized by the moderator on the site
Hi, sai, you can transpose them to single column firstly, then remove the blank rows. How to remove blank rows, you can go to this article, it introduces 4 ways to remove blank rows, there must be one method can help you. https://www.extendoffice.com/documents/excel/525-excel-remove-blank-rows.html
This comment was minimized by the moderator on the site
thanks a lot; beautifull :-)
This comment was minimized by the moderator on the site
Worked like a charm. Thanks a lot
This comment was minimized by the moderator on the site
thanxs you have reduced my too much time....wonderful
This comment was minimized by the moderator on the site
What if the table you start with has a range of values that is different for each row? Example: Say the table doesn't have FF, KK and LL, how do you make a single column from that table without doing them above example by hand?
This comment was minimized by the moderator on the site
Just try above methods, if they cannot work, please tell me and upload your data as a picture to give some details
This comment was minimized by the moderator on the site
THAT'S AMAZING! THANKYOU
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations