Formula to text join up to 10 rows and two columns stoping when the next lot of data starts?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

I have a very old supplier who send me information on multiple lines,
to use this data i need to combine it all together,

I was using the text join formula which worked great but now the number of rows is not consistent so i need to adjust it or use a different method.

The formula i used was this "=TEXTJOIN(", ",TRUE,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12)"
Now this worked great when i could rely on the products being 10 rows but now its changed so what i need is this:

Column A holds Product Names
Each product names Info is spread over multiple rows in columns B and C
I need to combine all the data in Columns B and C into D for as many rows as belong to that product
So

A2 is Product A
product B will be down column A somewhere lets say A7 so I need to combine all of B2 to C6 (going column b first then column C.

any ideas if and how this can be done?

Thanks

Tony
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
How about
Excel Formula:
=TEXTJOIN(", ",,IF(A2:A100=A2,B2:C100,""))
 
Upvote 0
In case that @Fluff 's formula (see above) doesn't fix the request try this much longer one:
Excel Formula:
=IF(A2<>"",TEXTJOIN(",",TRUE,TEXTJOIN(",",TRUE,OFFSET(A2,0,1,ABS(MIN(IF(A3:A100<>"",ROW(A3:A100),""))-ROW()),1)),TEXTJOIN(",",TRUE,OFFSET(A2,0,2,ABS(MIN(IF(A3:A100<>"",ROW(A3:A100),""))-ROW()),1))),"")
Set it in D2 then copy down as necessary

Bye
 
Upvote 0
Possibly this?

21 10 25.xlsm
ABCDEF
1
2Prod1DataB2DataE2Prod1DataB2,DataB3,DataB4,DataE2,DataE3,DataE4
3DataB3DataE3Prod2DataB5,DataB6,DataE5,DataE6
4DataB4DataE4Prod3DataB7,DataB8,DataB9,DataE7,DataE8,DataE9
5Prod2DataB5DataE5Prod4DataB10,DataB11,DataB12,DataB13,DataE10,DataE11,DataE12,DataE13
6DataB6DataE6Prod5DataB14,DataB15,DataE14,DataE15
7Prod3DataB7DataE7Prod6DataB16,DataB17,DataE16,DataE17
8DataB8DataE8 
9DataB9DataE9 
10Prod4DataB10DataE10
11DataB11DataE11
12DataB12DataE12
13DataB13DataE13
14Prod5DataB14DataE14
15DataB15DataE15
16Prod6DataB16DataE16
17DataB17DataE17
18
TJ
Cell Formulas
RangeFormula
E2:E7E2=FILTER(A2:A20,A2:A20<>"")
F2:F9F2=IF(E2="","",LET(a,A$2:A$100,b,B$2:B$100,c,C$2:C$100,s,MATCH(E2,a,0),e,IFERROR(MATCH(E3,a,0)-1,ROWS(a)),TEXTJOIN(",",1,INDEX(b,s):INDEX(b,e),INDEX(c,s):INDEX(c,e))))
Dynamic array formulas.
 
Upvote 0
.. or a tiny bit shorter

21 10 25.xlsm
ABCDEF
1
2Prod1DataB2DataE2Prod1DataB2,DataB3,DataB4,DataE2,DataE3,DataE4
3DataB3DataE3Prod2DataB5,DataB6,DataE5,DataE6
4DataB4DataE4Prod3DataB7,DataB8,DataB9,DataE7,DataE8,DataE9
5Prod2DataB5DataE5Prod4DataB10,DataB11,DataB12,DataB13,DataE10,DataE11,DataE12,DataE13
6DataB6DataE6Prod5DataB14,DataB15,DataE14,DataE15
7Prod3DataB7DataE7Prod6DataB16,DataB17,DataE16,DataE17
8DataB8DataE8 
9DataB9DataE9 
10Prod4DataB10DataE10
11DataB11DataE11
12DataB12DataE12
13DataB13DataE13
14Prod5DataB14DataE14
15DataB15DataE15
16Prod6DataB16DataE16
17DataB17DataE17
18
TJ (2)
Cell Formulas
RangeFormula
E2:E7E2=FILTER(A2:A20,A2:A20<>"")
F2:F9F2=IF(E2="","",LET(a,A$2:A$100,bc,B$2:C$100,TEXTJOIN(",",1,TRANSPOSE(INDEX(bc,MATCH(E2,a,0),1):INDEX(bc,IFERROR(MATCH(E3,a,0)-1,ROWS(a)),2)))))
Dynamic array formulas.
 
Upvote 0
Fluff, thanks you great idea,
Anthony very helpfull thank you for your input.
Peter, Wow what can i say, solved 100% thanks
Thank you to all of you for your help

Thanks

Tony
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,904
Members
449,194
Latest member
JayEggleton

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