Removing Zeros in the middle of a drawing number

Fola

New Member
Joined
Nov 16, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Web
Hi All, how do I remove the zeros after the second "- " of my drawing numbers? Thanks

ST0042-E8020-0373 to be ST0042-E8020-373
ST0042-E9006-0021 to be ST0042-E9006-21
ST0041-E8060-0001 to be ST0042-E8060-1

Can I have a single formula to fix this? Thanks.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try :

Excel Formula:
=LEFT(A2,13)&SUBSTITUTE(RIGHT(A2,4),"0","")
 
Upvote 0
Do you really want always to get rid of all the zeros? What if the drawing number was ST0041-E8060-1001? Would you really want to convert it to ST0041-E8060-11
 
Upvote 0
Do you really want always to get rid of all the zeros? What if the drawing number was ST0041-E8060-1001? Would you really want to convert it to ST0041-E8060-11
You are correct, not get rid of all the zeros but to convert it. Thanks.
 
Upvote 0
Maybe this
Excel Formula:
=IF(--LEFT(RIGHT(A1,4),1)>0,A1,LEFT(A1,13) & SUBSTITUTE(RIGHT(A1,4),"0",""))
 
Upvote 0
=TEXTBEFORE(A1,"-",-1)&TEXT(RIGHT(A1,4),"-0")
Thank you. It's close but some cells had errors. See below examples

Before After
ST0042-E2012-54ST0042-E2012-19756
ST0042-E4023-39ST0042-E4023-14305
ST0042-E4023-40ST0042-E4023-14671
ST0042-E4023-41ST0042-E4023-15036
ST0042-E4023-42ST0042-E4023-15401
ST0042-E4023-43ST0042-E4023-15766
ST0042-E4023-44ST0042-E4023-16132
ST0042-E4023-45ST0042-E4023-16497
ST0042-E4023-46ST0042-E4023-16862
ST0042-E4023-47ST0042-E4023-17227
ST0042-E4023-48ST0042-E4023-17593
ST0042-E4023-50ST0042-E4023-18323
ST0042-E4023-51ST0042-E4023-18688
It should have remained the same but the numbers at the end completely changed
 
Upvote 0
Maybe this
Excel Formula:
=IF(--LEFT(RIGHT(A1,4),1)>0,A1,LEFT(A1,13) & SUBSTITUTE(RIGHT(A1,4),"0",""))
Thank you a lot of cells that needed to remain unchanged came back as error.

ST0042-E9501-404#VALUE!
ST0042-E9501-405#VALUE!
ST0042-E9501-410#VALUE!
ST0042-E9501-411#VALUE!
ST0042-E9501-412#VALUE!
ST0042-E9501-413#VALUE!
ST0042-E9501-414#VALUE!
ST0042-E9501-415#VALUE!
ST0042-E9501-416#VALUE!
ST0042-E9501-417#VALUE!
ST0042-E9501-418#VALUE!
ST0042-E9501-419#VALUE!
ST0042-E9501-420#VALUE!
ST0042-E9501-421#VALUE!
 
Upvote 0
Try :

Excel Formula:
=LEFT(A2,13)&SUBSTITUTE(RIGHT(A2,4),"0","")
Please see below some errors
Before After
ST0042-E9501-1ST0042-E9501-1-1 Extra -1
ST0042-E9501-7ST0042-E9501-1-7 Extra -1
ST0042-E9501-8ST0042-E9501-1-8 Extra -1
ST0042-E9501-18ST0042-E9501-1-18
ST0042-E9501-19ST0042-E9501-1-19
ST0042-E8010-2ST0042-E8010-1-2
ST0042-E8020-369ST0042-E8020--369
ST0042-E8020-370ST0042-E8020--37 Double - & 37 should be 370
ST0042-E8020-371ST0042-E8020--371
ST0042-E8020-372ST0042-E8020--372
ST0042-E8020-350ST0042-E8020--35 Double - & 35 should be 350
ST0042-E8020-351ST0042-E8020--351
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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