Removing last specific character or characters

jamobe

New Member
Joined
Dec 23, 2014
Messages
36
Office Version
  1. 365
Platform
  1. Windows
Hi

I am using the following formula to remove a ";" from last character of a string if it exists

=IF(RIGHT(A1,1)=";",LEFT(A1,LEN(A1)-1),A1)

What I am struggling with is trying to nest this so that if the data had 2 semi colons it would also delete these

For example the data I have is as follows

EXAMPLE1;EXAMPLE1;EXAMPLE1

EXAMPLE2;EXAMPLE2;

EXAMPLE3;;

Is there a formula to remove the semi colons, at the end only and not to remove any other characters? Any help would be much appreciated!

Many Thanks

Jermaine
 
Here is another array-entered** formula that will work for any number of trailing semi-colons...
Could be useful for other readers** without Excel 365 but OP does have 365 so
- would not need to array enter and
- in any case can use the fewer-function-call formula at the bottom of post 5.
.. or if the target cell(s) could be blank:
Excel Formula:
=LEFT(A1,LEN(A1)-SUM(--(RIGHT(A1,SEQUENCE(LEN(A1)+1))=REPT(";",SEQUENCE(LEN(A1)+1)))))

** Without a check for empty cells it does have quite a massive calculation burden if it has to evaluate a number of them with this twice in each formula.
ROW(INDEX(A:A,1):INDEX(A:A,0))
 
Last edited:
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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