Replace last character (right-most) in a cell

EconSean

Board Regular
Joined
Apr 21, 2002
Messages
129
Greetings everyone,

I am trying to replace the last character (furthest to the right) in a cell, in most cases.

Specifically, I have thousands of rows, and in the vast majority of cases (but not all) the cell ends with a semicolon. I would like to get rid of that.

Seems easy enough, but I cannot come up with anything. There are other semicolons throughout my data, and I need them to remain. It is only in those instances that the semicolon is the last character in the cell do I want to replace them.

Any help will be greatly appreciated.

Regards,

Sean
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
Hi
try

=If(Right(A1)=";",Substitute(A1,";","",Len(A1)-Len(Substitute(A1,";",""))),A1)
 

ExcelChampion

Well-known Member
Joined
Aug 12, 2005
Messages
976
ah, Jindon helped me notice that you mention that not all have the semi colon...so:

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

EconSean

Board Regular
Joined
Apr 21, 2002
Messages
129
Jindon and Todd, thank you both for your prompt replies and valuable insight.

Take care,

Sean
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
57,319
Office Version
  1. 365
Platform
  1. Windows
Here's another possibility:
=LEFT(A1,LEN(A1)-(RIGHT(A1)=";"))
 

Forum statistics

Threads
1,181,362
Messages
5,929,534
Members
436,676
Latest member
Mavri

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
Top