Removing Trailing Characters in a String

DrDebit

Board Regular
Joined
May 20, 2013
Messages
123
Office Version
  1. 365
Platform
  1. Windows
I have columns of items. Some rows have 2 or 3, but some rows have 7 or 8, and everything in between. I merge all of the columns into one, each element separated by a semi-colon. However, some lists have several semi-colons strung together at the end. Is there a function, like the Text.TrimEnd function for spaces, that will eliminate semicolons at the end? Thank you so much!

1587532781244.png
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
This sounds like a standard Excel question but is in the Power BI forum :unsure:
(so this may not help)

One formula to try
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"; ","@@"),";",""),"@@","; ")
 
Last edited:
Upvote 0
Concatenating Text

Office 365 has function TEXTJOIN which allows concatenation with a delimiter ( "; " ), ignoring empty cells (TRUE/FALSE)

=TEXTJOIN("; ",TRUE,A1:J1)

With these values in any of the cells A1:J1:
Green Tomatoes
Goat
Cheese
Basil
Red Peppers

Formula returns:
Green Tomatoes; Goat; Cheese; Basil; Red Peppers
 
Upvote 0
Text.TrimEnd(text as nullable text, optional trim as any) as nullable text

Text.TrimEnd([ColumnWithText],";")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,793
Messages
6,174,636
Members
452,575
Latest member
Fstick546

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