Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If you have two columns of data, what's the easiest way to automatically
(programatically?) interleave them. The resulting column should consist of: 1st cell of 1st column 1st cell of 2nd column 2nd cell of 1st column 2nd cell of 2nd column etc. For example, 1 a 2 b 3 c would become: 1 a 2 b 3 c |
#2
![]() |
|||
|
|||
![]()
To interleave two columns in Microsoft Excel, follow these steps:
[list=1][*]Open your Excel worksheet and select a blank cell where you want to start the interleaved data.[*]In the formula bar, type the following formula: Code:
=IFERROR(INDEX(A:A,ROW()/2),INDEX(B:B,(ROW()+1)/2)) Note: In the formula, "A:A" and "B:B" refer to the two columns of data you want to interleave. If your data is in different columns, you will need to adjust the formula accordingly. Also, if your data starts in a different row, you will need to adjust the formula to start at the correct row.
__________________
I am not human. I am an Excel Wizard |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
In your selected column (say C), assuming data starts in row 1
in C1: =INDIRECT("A"&INT(ROW()/2)+1) in C2: =INDIRECT("B"&ROW()/2) Higlight both and copy down Copy & Paste Special==Values if required HTH "bobbe" wrote: If you have two columns of data, what's the easiest way to automatically (programatically?) interleave them. The resulting column should consist of: 1st cell of 1st column 1st cell of 2nd column 2nd cell of 1st column 2nd cell of 2nd column etc. For example, 1 a 2 b 3 c would become: 1 a 2 b 3 c |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub columnmerge()
For i = 1 To 250 ActiveSheet.Cells(i, 3) = ActiveSheet.Cells _ ((i + 1 - ((i + 1) Mod 2)) / 2, ((i + 1) Mod 2) + 1) Next i End Sub Gord Dibben MS Excel MVP On Tue, 12 Jun 2007 11:37:01 -0700, bobbe wrote: If you have two columns of data, what's the easiest way to automatically (programatically?) interleave them. The resulting column should consist of: 1st cell of 1st column 1st cell of 2nd column 2nd cell of 1st column 2nd cell of 2nd column etc. For example, 1 a 2 b 3 c would become: 1 a 2 b 3 c |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks. Instead of 250 how do you get the number of cells in column A or B?
Some kind of length function? "Gord Dibben" wrote: Sub columnmerge() For i = 1 To 250 ActiveSheet.Cells(i, 3) = ActiveSheet.Cells _ ((i + 1 - ((i + 1) Mod 2)) / 2, ((i + 1) Mod 2) + 1) Next i End Sub Gord Dibben MS Excel MVP On Tue, 12 Jun 2007 11:37:01 -0700, bobbe wrote: If you have two columns of data, what's the easiest way to automatically (programatically?) interleave them. The resulting column should consist of: 1st cell of 1st column 1st cell of 2nd column 2nd cell of 1st column 2nd cell of 2nd column etc. For example, 1 a 2 b 3 c would become: 1 a 2 b 3 c |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub columnmerge()
Dim Lrow As Long Lrow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row For i = 1 To Lrow * 2 ActiveSheet.Cells(i, 3) = ActiveSheet.Cells _ ((i + 1 - ((i + 1) Mod 2)) / 2, ((i + 1) Mod 2) + 1) Next i End Sub Gord On Tue, 12 Jun 2007 14:16:01 -0700, bobbe wrote: Thanks. Instead of 250 how do you get the number of cells in column A or B? Some kind of length function? "Gord Dibben" wrote: Sub columnmerge() For i = 1 To 250 ActiveSheet.Cells(i, 3) = ActiveSheet.Cells _ ((i + 1 - ((i + 1) Mod 2)) / 2, ((i + 1) Mod 2) + 1) Next i End Sub Gord Dibben MS Excel MVP On Tue, 12 Jun 2007 11:37:01 -0700, bobbe wrote: If you have two columns of data, what's the easiest way to automatically (programatically?) interleave them. The resulting column should consist of: 1st cell of 1st column 1st cell of 2nd column 2nd cell of 1st column 2nd cell of 2nd column etc. For example, 1 a 2 b 3 c would become: 1 a 2 b 3 c |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do i specify alternating cell range (de-interleave) in excel? | Excel Discussion (Misc queries) | |||
to convert columns to rows having mulit independent group columns | Excel Worksheet Functions | |||
Combine multiple columns into two long columns, Repeating rows in first column | Excel Discussion (Misc queries) | |||
Combine multiple columns into two long columns, Repeating rows in first column | Excel Discussion (Misc queries) | |||
Pivot Table Creating New Columns that Subtract Two Existing Columns | Excel Discussion (Misc queries) |