Skip to main content

How to quickly stack multiple columns into one column in Excel?

in Excel, the Text to columns function can split a cell into multiple columns based on delimiter, but if there are any ways to stack multiple columns into one column as below screenshot shown? In this article, I will introduce some tricks on solving this task quickly.
doc stack columns to one 1

Stack multiple columns into one with formula

Stack multiple columns into one with VBA

Stack multiple columns into one with Transform Range good idea3


Stack multiple columns into one with formula

1. Select the range you want to stack, and go to the Name Box to give this range a name, and press Enter key. See screenshot:
doc stack columns to one 2

2. Then select a blank cell that you want place the results, enter this formula =INDEX(MyData,1+INT((ROW(A1)-1)/COLUMNS(MyData)),MOD(ROW(A1)-1+COLUMNS(MyData),COLUMNS(MyData))+1), press Enter key and drag fill handle down until an error displayed. See screenshot:
doc stack columns to one 3

In the formula, MyData is the range name you have specified in step 1.

Stack multiple columns into one with VBA

Here is a VBA code that can help you too.

1. Press Alt + F11 keys to display Microsoft Visual Basic for Applications window.

2. Click Insert > Module, paste below code to the Module.

VBA: Stack columns to one

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 stack columns to one 4

3. Press F5 key to run the code, a dialog pops out to select the source data, and click OK, to select a cell to place the results. See screenshot:
doc stack columns to one 5

4. Click OK. Now the columns have been stacked in one column.
doc stack columns to one 6


Stack multiple columns into one with Transform Range

To apply Kutools for Excel’s Transform Range utility is also can help you quickly solve this problem.

Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. 

After free installing Kutools for Excel, please do as below:

1. Select the columns data you use, and click Kutools > Range > Transform Range. See screenshot:
doc stack columns to one 8

2. In the Transform Range dialog, check Range to single column option, and click Ok, then select a cell to place results. See screenshot:
doc stack columns to one 9

3. Click OK. Now the columns have been stacked into one single column.
doc stack columns to one 1

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (25)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
For those looking to stack columns into one but not rows into one, you need to have a clear picture of what you really want to do.Suppose you have some 3x3 array, you want your index() function to get entries in the form of (row,column) for (1,1), (2,1), (3,1), then (1,2), (2,2), (3,2) then so on.So what you want to do is to have index() refer to a single column containing all the row numbers (1;2;3;1;2;3;1;2;3) and a single column containing all the column numbers (1;1;1;2;2;2;3;3;3).To get (1;2;3;1;2;3;1;2;3), a common programming approach is to use 1+mod(some_counter-1,3) where the mod() function gives the residuals 0,1,2,0,1,2,...
To get (1;1;1;2;2;2;3;3;3), one uses 1+int((some_counter-1)/3) where it gives 1+0, 1+0, 1+0, 1+1, 1+1, 1+1, 1+2, 1+2, 1+2
Therefore, to get a 3x3 array stacked into one, you use the formula (press Ctrl +Shft + Enter):=index( $A$1:$C$3, 1+mod(row(A1)-1,3), 1+int((row(A1)-1)/3)))where row(A1) serves as the counter as you fill your formula downwards
If you put it the other way round (row to columns, columns to row), you will get rows stacked into one column=INDEX( $A$1:$C$3, 1+INT((ROW(A1)-1)/3),1+MOD(ROW(A1)-1,3))which is essentially what the formula in this article does

In a nutshell, the formula used to stack columns in an array into a single column would be:=index( your_array_cells , 1+mod(row(A1)-1, number_of_rows_of_your_array ), 1+int((row(A1)-1)/ number_of_columns_of_your_array)))
This comment was minimized by the moderator on the site
Thank you for the formula and VBA, but neither one does what the title of the post says. I was expecting them to stack the columns, but instead they transpose each row into a column and stacks those... so it's stacking transposed rows, not columns. Still very helpful for some cases, but does anyone know how to modify the formula and/or VBA to actually stack the columns? I suppose I could transpose the entire input range then use these...
This comment was minimized by the moderator on the site
Thank you, a lot, the formula option worked very well.. your saved my lot of time.
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
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
This comment was minimized by the moderator on the site
Hi, Tom, which method you apply does not work? The method three, transform range tool must can work.
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
Hi, Chris Blackburn, sorry I am affraid I cannot find a code can automatically run to update the result, maybe someone else can.
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
Hello , is there any to convert above data to following form ??
1
A
Lilly
2
B
Judy
...
This comment was minimized by the moderator on the site
Thanks for your leaving message, this tutorial https://www.extendoffice.com/documents/excel/5401-excel-stack-columns-into-one-column.html
is talking about how to solve this problem, you can go to view.
This comment was minimized by the moderator on the site
this is just a clickbait to have you download a paying software
This comment was minimized by the moderator on the site
The first download will be free to use in 60 days, after that, you can decide to pay for use or not.
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