跳到主要內容

如何將列和行轉置/轉換為單列?

當您使用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工作表中的多行和多列。 您有任何快速的解決方法嗎? 在這裡 移調範圍 功能 Excel的Kutools 可以輕鬆處理以上所有工作。點擊即可獲得 30 天的全功能免費試用!
doc1
 
Kutools for Excel:擁有300多個便捷的Excel加載項,可以在30天內免費試用。

使用VBA代碼將列和行轉置/轉換為單列

使用以下VBA代碼,您還可以將多列和多行連接為單列。

1.按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。

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代碼對您有一些限制,在這種情況下,請不要擔心,在這裡,我將向您介紹一個更簡單,更多功能的工具-Excel的Kutools,其 Transform Range 實用程序,您可以快速方便地解決此問題。

Excel的Kutools, 與以上 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將交叉表轉換為列表表

如果您需要將交叉表轉換為列表表(如屏幕截圖所示),除了逐一重新鍵入數據外,還可以使用 Excel的KutoolsTranspose 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選項卡為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