Ir para o conteúdo principal

Como empilhar rapidamente várias colunas em uma coluna no Excel?

no Excel, a função Texto para colunas pode dividir uma célula em várias colunas com base no delimitador, mas se houver alguma maneira de empilhar várias colunas em uma coluna, como mostrado na imagem abaixo? Neste artigo, vou apresentar alguns truques para resolver essa tarefa rapidamente.
doc empilhar colunas para uma 1

Empilhe várias colunas em uma com fórmula

Empilhe várias colunas em uma com VBA

Empilhe várias colunas em uma com Transform Range boa ideia 3


Empilhe várias colunas em uma com fórmula

1. Selecione o intervalo que deseja empilhar e vá para o nome Box para dar um nome a este intervalo e pressione Entrar chave. Veja a imagem:
doc empilhar colunas para uma 2

2. Em seguida, selecione uma célula em branco onde deseja colocar os resultados, insira esta fórmula =INDEX(MyData,1+INT((ROW(A1)-1)/COLUMNS(MyData)),MOD(ROW(A1)-1+COLUMNS(MyData),COLUMNS(MyData))+1), pressione Entee arraste a alça de preenchimento para baixo até que um erro seja exibido. Veja a imagem:
doc empilhar colunas para uma 3

Na fórmula, MyData é o nome do intervalo que você especificou na etapa 1.

Empilhe várias colunas em uma com VBA

Aqui está um código VBA que também pode ajudá-lo.

1. Pressione Alt + F11 chaves para mostrar Microsoft Visual Basic para Aplicações janela.

2. Clique inserção > Módulo, cole o código abaixo no Módulo.

VBA: Empilhar colunas em uma

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 empilhar colunas para uma 4

3. Pressione F5 para executar o código, uma caixa de diálogo é exibida para selecionar os dados de origem e clique em OK, para selecionar uma célula para colocar os resultados. Veja a imagem:
doc empilhar colunas para uma 5

4. Clique OK. Agora as colunas foram empilhadas em uma coluna.
doc empilhar colunas para uma 6


Empilhe várias colunas em uma com Transform Range

Aplicar Kutools for Excel'S Faixa de transformação utilitário também pode ajudá-lo a resolver esse problema rapidamente.

Kutools for Excel, com mais de 300 funções úteis, tornam seus trabalhos mais fáceis. 

Depois de instalação grátis Kutools para Excel, faça o seguinte:

1. Selecione os dados das colunas que você usa e clique em Kutools > Variação > Faixa de transformação. Veja a imagem:
doc empilhar colunas para uma 8

2. No Faixa de transformação diálogo, verificar Faixa para coluna única opção e clique Oke selecione uma célula para inserir os resultados. Veja a imagem:
doc empilhar colunas para uma 9

3. Clique OK. Agora as colunas foram empilhadas em uma única coluna.
doc empilhar colunas para uma 1

Melhores ferramentas de produtividade de escritório

🤖 Assistente de IA do Kutools: Revolucionar a análise de dados com base em: Execução Inteligente   |  Gerar Código  |  Crie fórmulas personalizadas  |  Analise dados e gere gráficos  |  Invocar funções do Kutools...
Recursos mais comuns: Encontre, destaque ou identifique duplicatas   |  Excluir linhas em branco   |  Combine colunas ou células sem perder dados   |   Rodada sem Fórmula ...
Super pesquisa: VLookup de múltiplos critérios    VLookup de múltiplos valores  |   VLookup em várias planilhas   |   Pesquisa Difusa ....
Lista suspensa avançada: Crie rapidamente uma lista suspensa   |  Lista suspensa de dependentes   |  Lista suspensa de seleção múltipla ....
Gerenciador de colunas: Adicione um número específico de colunas  |  Mover colunas  |  Alternar status de visibilidade de colunas ocultas  |  Compare intervalos e colunas ...
Recursos em destaque: Foco da Grade   |  Vista de Design   |   Grande Barra de Fórmula    Gerenciador de pastas de trabalho e planilhas   |  Biblioteca (Auto texto)   |  Data Picker   |  Combinar planilhas   |  Criptografar/Descriptografar Células    Enviar e-mails por lista   |  Super Filtro   |   Filtro Especial (filtro negrito/itálico/tachado...) ...
15 principais conjuntos de ferramentas12 Texto Ferramentas (Adicionar texto, Remover Personagens, ...)   |   50+ de cores Tipos (Gráfico de Gantt, ...)   |   Mais de 40 práticos Fórmulas (Calcule a idade com base no aniversário, ...)   |   19 Inclusão Ferramentas (Insira o código QR, Inserir imagem do caminho, ...)   |   12 Conversão Ferramentas (Números para Palavras, Conversão de moedas, ...)   |   7 Unir e dividir Ferramentas (Combinar linhas avançadas, Dividir células, ...)   |   ... e mais

Aprimore suas habilidades de Excel com o Kutools para Excel e experimente uma eficiência como nunca antes. Kutools para Excel oferece mais de 300 recursos avançados para aumentar a produtividade e economizar tempo.  Clique aqui para obter o recurso que você mais precisa...

Descrição


Office Tab traz interface com guias para o Office e torna seu trabalho muito mais fácil

  • Habilite a edição e leitura com guias em Word, Excel, PowerPoint, Publisher, Access, Visio e Project.
  • Abra e crie vários documentos em novas guias da mesma janela, em vez de em novas janelas.
  • Aumenta sua produtividade em 50% e reduz centenas de cliques do mouse para você todos os dias!
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