Exclude from concatenated text if text equals "xxx"
I am trying to concatenate text from 10 cells that are not next to each other into 1 while excluding text that is equal to "Not Required".
This is the formula I am using to concatenate the text. I have also tried the Join function without success.
This is the result, which is correct, but as you can see it excluding "Not Required" would be a lot more presentable in reports, dashboards and other sheets this is linked to.
Any ideas would be greatly appreciated!
Best Answer
-
I would use the JOIN, DISTINCT, and SUBSTITUTE combination.
=SUBSTITUTE(JOIN(DISTINCT([Reviewer 1]@row:[Reviewer 10]@row), ", ") + ", ", "Not Required" + ", ", "")
DISTINCT([Reviewer 1]@row:[Reviewer 10]@row)
gives unique Reviewers, including "Not Required"
JOIN(DISTINCT([Reviewer 1]@row:[Reviewer 10]@row), ", " )
concatenates Reviewers with ", " delimiter.
SUBSTITUTE(JOIN(DISTINCT([Reviewer 1]@row:[Reviewer 10]@row), ", ") + ", ", "Not Required" + ", ", "")
add ", " at the end and remove "Not Required"+ ", " or "Not Required, ".
If you want to remove the last ", ", use this formula.
=LEFT([Concept Reviewers]@row, LEN([Concept Reviewers]@row) - 1)
Answers
-
I would use the JOIN, DISTINCT, and SUBSTITUTE combination.
=SUBSTITUTE(JOIN(DISTINCT([Reviewer 1]@row:[Reviewer 10]@row), ", ") + ", ", "Not Required" + ", ", "")
DISTINCT([Reviewer 1]@row:[Reviewer 10]@row)
gives unique Reviewers, including "Not Required"
JOIN(DISTINCT([Reviewer 1]@row:[Reviewer 10]@row), ", " )
concatenates Reviewers with ", " delimiter.
SUBSTITUTE(JOIN(DISTINCT([Reviewer 1]@row:[Reviewer 10]@row), ", ") + ", ", "Not Required" + ", ", "")
add ", " at the end and remove "Not Required"+ ", " or "Not Required, ".
If you want to remove the last ", ", use this formula.
=LEFT([Concept Reviewers]@row, LEN([Concept Reviewers]@row) - 1)
-
That is brilliant! Thank you so much, it was driving me crazy.
-
Happy to help!😁
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.4K Get Help
- 424 Global Discussions
- 221 Industry Talk
- 465 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 144 Just for fun
- 62 Community Job Board
- 463 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 300 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!