- To post as a guest, your comment is unpublished.· 1 years agoHi, Jas,
To do the opposite of this, to convert two columns data into one single column, you should apply the below VBA code:
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
Range2.Offset(rowIndex, 0).PasteSpecial Paste:=xlPasteAll, Transpose:=True
rowIndex = rowIndex + Rng.Columns.Count
Application.CutCopyMode = False
Application.ScreenUpdating = True
Please try, hope it can help you!
How to split a column every other row in Excel?
For example, I have a long list of data, and now, I want to split the column into two lists equally by every other row as following screenshot shown. Are there any good ways to deal with this task in Excel?
Split a single column into every other or nth row:
With Kutools for Excel's Transform Range utility, you can quickly convert a single row or column to a range of cells or vice versa.
The following formulas may help you to quickly split a column into two columns by every other row, please do as follows:
1. Enter this formula into a blank cell, C2, for example, =INDEX($A$2:$A$13,ROWS(C$1:C1)*2-1), see screenshot：
2. Then drag the fill handle down until the errors are displayed in the cells, see screenshot:
3. Then enter another formula into cell D2, =INDEX($A$2:$A$13,ROWS(D$1:D1)*2), and drag the fill handle down to the cells until error values appears, and the column values have been split into two columns every other row, see screenshot:
If you are interested in VBA code, here, I can talk about a code for you to solve this problem.
1. Hold down the ALT + F11 keys in Excel, and it opens the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code:Split a column into two columns every other row
Sub SplitEveryOther() 'Updateby20150813 Dim Rng As Range Dim InputRng As Range, OutRng As Range Dim index As Integer xTitleId = "KutoolsforExcel" Set InputRng = Application.Selection Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8) Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8) Set OutRng = OutRng.Range("A1") num1 = 1 num2 = 1 For index = 1 To InputRng.Rows.Count If index Mod 2 = 1 Then OutRng.Cells(num1, 1).Value = InputRng.Cells(index, 1) num1 = num1 + 1 Else OutRng.Cells(num2, 2).Value = InputRng.Cells(index, 1) num2 = num2 + 1 End If Next End Sub
3. Then press F5 key to run this code, and a prompt box will pop out to remind you select the data range that you want to split, see screenshot:
4. And click OK, another prompt box is popped put to let you select a cell to put the result, see screenshot:
5. Then click OK, and the column has been split into two columns by every other row. See screenshot:
If you want to learn more new things, I can recommend a powerful tool --Kutools for Excel, with its Transform Range utility, you can quickly convert a single row or column to a range of cells and vice versa.
|Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.|
After installing Kutools for Excel, please do as follows:( Free Download Kutools for Excel Now )
1. Select the column data that you want to split into two columns by every other row.
2. Then click Kutools > Range > Transform Range, see screenshot:
3. In the Transform Range dialog box, select Single column to range under the Transform type, then choose Fixed value and enter 2 into the box in the Rows per record section, see screenshot:
4. Then click Ok button, and a prompt box will pop out to remind you select a cell where you want to output the result, see screenshot:
5. Click OK, the list data has been split into two columns every other row.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 1 years agoHow to do the opposite of this? Get two column info in one row ?
- To post as a guest, your comment is unpublished.· 3 years agoAs a workaround, you can do the following:
Using the above example,
1. Type "=a2" in c2 and "=a3" in d3.
2. Now select c2 through d3.
3. Drag the fill handle parallel to all the data.
4. Now delete cell a2 and shift cells up.
5. Now we need to convert the formula results to the calculated values. That's easily done by copying all the data including the blank rows and pasting the values right on top of itself.
6. Now you can simply sort any of the column alphabetically to bring all the data up.