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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi
try

=If(Right(A1)=";",Substitute(A1,";","",Len(A1)-Len(Substitute(A1,";",""))),A1)
 
Upvote 0
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)
 
Upvote 0
Jindon and Todd, thank you both for your prompt replies and valuable insight.

Take care,

Sean
 
Upvote 0
Here's another possibility:
=LEFT(A1,LEN(A1)-(RIGHT(A1)=";"))
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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