Concatenate/TextJoin using a different delimiter between 2nd Last and Last entry (Excel or Sheets)

Jaypee666

New Member
Joined
May 26, 2020
Messages
26
Office Version
  1. 365
  2. 2016
  3. 2010
Platform
  1. Windows
Hi all,
Not sure if what I'm looking to do is possible or not.
I have 2 columns M & N that populate based on another columns content.
I then have 2 cells that do a TextJoin on the relevant column, J15 does a TextJoin for Column M & J17 for N
What I'm wondering is, Is itpossible to Concatentate/TextJoin using a different delimiter between 2nd Last and Last entry in either Excel or Google Sheets.

So in the sample provided below is it possible to have J15 return Area 1, Area 2 & Area 3 and J7 to return Area 4 & Area 5

Board-Sample.xlsx
JKLMN
13NOTESHighModerate
14HIGH  
15Area 1, Area 2, Area 3,Area 1, 
16MODERATE  
17Area 4, Area 5,Area 2, 
18  
19Area 3, 
20  
21 Area 4,
22  
23 Area 5,
24  
25  
Report-1
Cell Formulas
RangeFormula
M14,M16,M18,M20,M22,M24M14=IFNA(IF(G14="HIGH",CONCATENATE("Area ", A14,","), ""),"")
N14,N16,N18,N20,N22,N24N14=IFNA(IF(G14="MODERATE",CONCATENATE("Area ", A14,","), ""),"")
M15,M17,M19,M21,M23,M25M15=IFNA(IF(G15="HIGH",CONCATENATE("Area ", A14,","), ""),"")
N15,N17,N19,N21,N23,N25N15=IFNA(IF(G15="MODERATE",CONCATENATE("Area ", A14,","), ""),"")
J15J15=TEXTJOIN(" ", TRUE, M14:M53)
J17J17=TEXTJOIN(" ", TRUE, N14:N53)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
M14:N73Expression=AND(COUNTIF($M$14:$N$43,M14)>1,$N14<>"")textNO



Thanks for looking
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Another option
Fluff.xlsm
JKLMN
13NOTESHighModerate
14HIGH
15Area 1, Area 2 & Area 3Area 1,
16MODERATE
17Area 4 & Area 5Area 2,
18
19Area 3,
20
21Area 4,
22
23Area 5,
24
Data
Cell Formulas
RangeFormula
J15J15=LET(t,TEXTJOIN(", ",,SUBSTITUTE(M14:M53,",","")),SUBSTITUTE(t,", "," & ",LEN(t)-LEN(SUBSTITUTE(t,",",""))))
J17J17=LET(t,TEXTJOIN(", ",,SUBSTITUTE(N14:N53,",","")),SUBSTITUTE(t,", "," & ",LEN(t)-LEN(SUBSTITUTE(t,",",""))))
 
Upvote 0
Solution
Thank you both,

I am going to go with Fluffs, as it worked immediately. For some reason I can't see, StephenCrumps is not returning as expected, as seen below

Cell Formulas
RangeFormula
M14,M16,M18,M20,M22,M24,M26M14=IFNA(IF(G14="HIGH",CONCATENATE("Area ", A14,","), ""),"")
N14,N16,N18,N20,N22,N24,N26N14=IFNA(IF(G14="MODERATE",CONCATENATE("Area ", A14,","), ""),"")
M15,M17,M19,M21,M23,M25M15=IFNA(IF(G15="HIGH",CONCATENATE("Area ", A14,","), ""),"")
N15,N17,N19,N21,N23,N25N15=IFNA(IF(G15="MODERATE",CONCATENATE("Area ", A14,","), ""),"")
J15J15=TEXTJOIN(" ", TRUE, M14:M53)
J17J17=TEXTJOIN(" ", TRUE, N14:N53)
J20J20=LET(d,M14:M25,n,COUNTA(d),t,TEXTJOIN(", ",1,d),IF(n<2,t,SUBSTITUTE(t,","," &",n-1)))
J21J21=LET(d,N14:N25,n,COUNTA(d),t,TEXTJOIN(", ",1,d),IF(n<2,t,SUBSTITUTE(t,","," &",n-1)))
J24J24=LET(t,TEXTJOIN(", ",,SUBSTITUTE(M14:M25,",","")),SUBSTITUTE(t,", "," & ",LEN(t)-LEN(SUBSTITUTE(t,",",""))))
J25J25=LET(t,TEXTJOIN(", ",,SUBSTITUTE(N14:N25,",","")),SUBSTITUTE(t,", "," & ",LEN(t)-LEN(SUBSTITUTE(t,",",""))))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
M14:N73Expression=AND(COUNTIF($M$14:$N$43,M14)>1,$N14<>"")textNO


If you can see what is wrong with StephenCrumps let me know please, only change I made was to the Range. :(
 
Upvote 0
Stephen's doesn't work as you have formulae in M14:M25 which is causing the problem.
 
Upvote 0
For Sheets you could try
Excel Formula:
=SUBSTITUTE(TEXTJOIN(", ",,SUBSTITUTE(M14:M25,",","")),", "," & ",LEN(TEXTJOIN(", ",,SUBSTITUTE(M14:M25,",","")))-LEN(SUBSTITUTE(TEXTJOIN(", ",,SUBSTITUTE(M14:M25,",","")),",","")))
 
Upvote 0
Stephen's doesn't work as you have formulae in M14:M25 which is causing the problem.
I was working off the presumption that his covers the range A2:A10 where the data is, I want to use the range M14:M25 where my data is. Does it matter where the formula is in relation to the range? It has me confused beyond belief at the moment.
 
Upvote 0
Stephen's formula is using COUNTA to work out how many values you have, but that counts all cells with a formula, hence the problem.
 
Upvote 0
Stephen's formula is using COUNTA to work out how many values you have, but that counts all cells with a formula, hence the problem.
Yes, of course, sorry I read your initial response incorrectly, thanks for the clarification :)
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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