Converting a string of text into a custom format.

archilles89

New Member
Joined
Jun 3, 2018
Messages
5
Hi,

I have a string of characters which starts from random numbers and ends with a letter.

I want to add a "-" into every string right before the letter. For example:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]String[/TD]
[TD="align: center"]Wanted Result[/TD]
[/TR]
[TR]
[TD="align: center"]51313202041A[/TD]
[TD="align: center"]51313202041-A[/TD]
[/TR]
[TR]
[TD="align: center"]000035140B[/TD]
[TD="align: center"]000035140-B[/TD]
[/TR]
[TR]
[TD="align: center"]9482939498c[/TD]
[TD="align: center"]9482939498-c[/TD]
[/TR]
</tbody>[/TABLE]

Any help is tremendously appreciated. Thanks!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
It is not clear what kind of solution that you are after... would a formula solution be acceptable?

=REPLACE(A1,LEN(A1),0,"-")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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