Concatenate Every Second Row for Certain Number of Rows

PostTIT

Board Regular
Joined
Aug 22, 2016
Messages
94
As my title suggests I'm wanting to concatenate data that is in a single column. (e.g. Column A:A)
But I only want to concatenate data in every second row (i.e. A1,A3,A5,etc...)
I have another cell (e.g. B1) that contains an inputted number by the user. I'm looking for this number to limit the amount of cells that are concatenated. (i.e. if "B1 = 6" then I want to concatenate "A1,A3,A5,A7,A9,A11" and if "B1 = 2" then concatenate "A1,A3")

I have tried a simple concatenate function and selected the cells that I want, but I'm looking to automate it using a function (not a macro as I find other users don't appreciate macro-enabled workbooks, therefore don't enable them, therefore miss out on the functions they provide).

I have tried concatenate(transpose) but with the same result as above.

I have tried the following formula:

Code:
=CONCATENATE((MOD(ROW(OFFSET($A$1,,,1+2*($B$1-1)))-ROW($A$1),2)=0)*OFFSET($A$1,,,1+2*($B$1-1)))

but it only outputted the final value, not all of them, which wasn't desired.

And then from that I've taken various edits of the OFFSET section of the formula and used with the CONCATENATE and TRANSPOSE functions and had no luck.
I feel like I'm fairly close, but just falling short every time. Any help would be greatly appreciated.
 
Last edited by a moderator:
In a blank sheet put a-h in A1:A8
put 3 in B1

Copying this formula down a column

=IF((MOD(ROW(A1:A1000),2)=1)*(ROW(A1:A1000)<=B$1*2-1),A1:A1000)
Array formula, use Ctrl-Shift-Enter

results in

a
0
c
0
e
0
0
0

I don't have the means to test TEXTJOIN as I'm using an older version of Excel.
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
TEXTJOIN solution is this I think:


Book1
ABC
1a8a,c,e,g,i,k,m,o
2b
3c
4d
5e
6f
7g
8h
9i
10j
11k
12l
13m
14n
15o
16p
17q
18r
19s
20t
21u
22v
23w
24x
25y
26z
Sheet1
Cell Formulas
RangeFormula
C1{=TEXTJOIN(",",TRUE,IF(MOD(ROW($A$1:$A$26),2)=1,IF(ROW($A$1:$A$26)<$B$1*2,$A$1:$A$26,""),""))}
Press CTRL+SHIFT+ENTER to enter array formulas.


WBD
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,206
Members
453,022
Latest member
RobertV1609

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