TextJoin Function

Kathryn_Marie

New Member
Joined
Feb 3, 2020
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hi All,
I need to create a folder path from a raw data source which will update often. The data is on this format:

Material (SAP L.1-5 Functional Process Hierarchy)
_Simulation Guide
_eLearning Guide
_Title Page
_Audience and Prerequisites
_Housekeeping
_Topics
Topic 1 - <Title>
_Topic
_Objectives
_Introduction
_Simulation - <Title>
_Conclusion

I have used this formula which almost works, but it keeps adding previous entries from the same column which I do not want. Wondering is anyone may know how I can use this formula till it finds an entry, then starts again, or if there is another way to do this. This is what I have which gives the result below:

=TEXTJOIN("/", TRUE, E$2:E2, F$2:F2, G$2:G2, H$2:H2, I$2:I2, J$2:J2)

Content
Content/Material (SAP L.1-5 Functional Process Hierarchy)
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Title Page
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Title Page/_Audience and Prerequisites
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Title Page/_Audience and Prerequisites/_Housekeeping
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Title Page/_Audience and Prerequisites/_Housekeeping/_Topics
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Title Page/_Audience and Prerequisites/_Housekeeping/_Topics/Topic 1 - <Title>
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Title Page/_Audience and Prerequisites/_Housekeeping/_Topics/Topic 1 - <Title>/_Topic
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Title Page/_Audience and Prerequisites/_Housekeeping/_Topics/Topic 1 - <Title>/_Topic/_Objectives
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Title Page/_Audience and Prerequisites/_Housekeeping/_Topics/Topic 1 - <Title>/_Topic/_Objectives/_Introduction
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Title Page/_Audience and Prerequisites/_Housekeeping/_Topics/Topic 1 - <Title>/_Topic/_Objectives/_Introduction/_Simulation - <Title>
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Title Page/_Audience and Prerequisites/_Housekeeping/_Topics/Topic 1 - <Title>/_Conclusion/_Topic/_Objectives/_Introduction/_Simulation - <Title>
Content/Material (SAP L.1-5 Functional Process Hierarchy)/_Simulation Guide/_eLearning Guide/_Quiz Guide/_Title Page/_Audience and Prerequisites/_Housekeeping/_Topics/Topic 1 - <Title>/_Conclusion/_Topic/_Objectives/_Introduction/_Simulation - <Title>
 
Sticking to your original request for a TEXTJOIN solution, would this adaptation of Ron's initial formula work for you?

Cell Formulas
RangeFormula
I2:I14I2=TRIM(LEFT(SUBSTITUTE(TEXTJOIN("/",TRUE,LOOKUP("ZZZ",D$2:D2),IFERROR(LOOKUP("ZZZ",E$2:E2),""),IFERROR(LOOKUP("ZZZ",F$2:F2),""),IFERROR(LOOKUP("ZZZ",G$2:G2),"")),"/",REPT(" ",999),MATCH("?*",C2:G2,0)-1),999))
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I would definitely much prefer this option, however I updated your code to match what I required in my spreadsheet, and I am just getting the value from column F, nothing else :/

=TRIM(LEFT(SUBSTITUTE(TEXTJOIN("/",TRUE,LOOKUP("ZZZ",F$2:F2),IFERROR(LOOKUP("ZZZ",G$2:G2),""),IFERROR(LOOKUP("ZZZ",H$2:H2),""),IFERROR(LOOKUP("ZZZ",I$2:I2),""),IFERROR(LOOKUP("ZZZ",J$2:J2),""),IFERROR(LOOKUP("ZZZ",K$2:K2),"")),"/",REPT(" ",999),MATCH("?*",C2:K2,0)-1),999))
 
Upvote 0
Hard to tell exactly without seeing your data and layout, but I did have something not quite ideal in my formula.
If this does not resolve the problem, please post a small set of sample data and expected results with XL2BB so that we can
a) See exactly what rows & columns the data is in
b) See what column the formula is in, and
b) Copy the data to our sheet for testing

Cell Formulas
RangeFormula
L2:L14L2=TRIM(LEFT(SUBSTITUTE(TEXTJOIN("/",TRUE,LOOKUP("ZZZ",F$2:F2),IFERROR(LOOKUP("ZZZ",G$2:G2),""),IFERROR(LOOKUP("ZZZ",H$2:H2),""),IFERROR(LOOKUP("ZZZ",I$2:I2),""),IFERROR(LOOKUP("ZZZ",J$2:J2),""),IFERROR(LOOKUP("ZZZ",K$2:K2),"")),"/",REPT(" ",999),MATCH("?*",F2:K2,0)),999))
 
Upvote 0

Forum statistics

Threads
1,223,927
Messages
6,175,444
Members
452,642
Latest member
acarrigan

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