Merge 2 columns into 1 formula

Fin Fang Foom

Well-known Member
Joined
Mar 20, 2005
Messages
598
Hi everyone,


I would like to merge two columns into one, Col B & Col C and output it in column G. I have this formula below but its not working out how I would like it.

=INDEX($B$2:$C$20,1+INT((ROWS(E$2:E2)-1)/COLUMNS($B$2:$C$20)),1+MOD(ROWS(E$2:E2)-1,COLUMNS($B$2:$C$20)))


I left a small example below that shows the expected results in column G. Is this possible?
Book4
ABCDEFG
1Data1Data2Expected results
210111010
350221150
44055040
58042280
66074060
770100570
8868011
96422
102605
1174
12707
13100100
14086
15866
1602
176
180
192
20
Sheet1
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Book1
BCDE
1Data1Data26
210119
35022Data
440510
580450
660740
77010080
88660
9670
10211
1122
125
134
147
15100
1686
176
182
19 
Sheet1


E1:

=COUNTA(B2:B7)

E2:

=COUNTA(C2:C10)

E4, copied down:

=IF(ROWS($E$4:E4)<=$E$1+$E$2,IF(ROWS($E$4:E4)>$E$1,INDEX($C$2:$C$10,ROWS($E$4:E4)-$E$1),INDEX($B$2:$B$7,ROWS($E$4:E4))),"")
 
Upvote 0
Great thank you so much Aladin Akyurek!


What if I have more columns I would like to merge how would we go about modifying the formula?


Example below.
Book4
BCDEFG
1Data1Data2Data3Data4Data5Expected results
21011482310
3502212350
4405508987440
580411121380
660715161760
77010096979870
88665488511
96891022
1022345
117894
124567
13100
1486
156
162
174
181
19508
2011
2115
2296
23654
248
252
267
274
288
Sheet1
 
Upvote 0
Book1
ABCDEFGH
1Data1Data2Data3Data4Data50Data
210114823610
350221231550
440550898742640
58041112133780
66071516174860
77010096979870
88665488511
96891022
1022345
117894
124567
13100
1486
156
162
Sheet2


G1: 0
G2:

=G1+COUNTA(A2:A7)

G3:

=G2+COUNTA(B2:B10)

G4:

=G3+COUNTA(C2:C12)

G5:

=G4+COUNTA(D2:D12)

G6:

=G5+COUNTA(E2:E12)

H2, copied down:

=IF(ROWS($H$2:H2)<=$G$6,INDEX(CHOOSE(MATCH(ROWS($H$2:H2)-(LOOKUP(ROWS($H$2:H2),$G$1:$G$6)=ROWS($H$2:H2)),$G$1:$G$6),$A$2:$A$7,$B$2:$B$10,$C$2:$C$12,$D$2:$D$12,$E$2:$E$12),ROWS($H$2:H2)-LOOKUP(ROWS($H$2:H2)-1,$G$1:$G$6)),"")
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,755
Members
449,094
Latest member
dsharae57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top