Excel formula to remove a certain number of characters IF...

Jfreshh330

New Member
Joined
Apr 1, 2018
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hello All,

I'm looking for a formula that will see if a cell begins with either "000000", "000001", or "000005", and if so, modify the text like below.

If text in cell begins with 000000, then display the original value with four zeroes (0000) instead of six zeroes (000000)
Example: Cell B2 shows 0000008530X4140, so since this cell begins with 000000, then only display 00008530X4140

If text in cell begins with 000001, then display the original value without the preceding five zeroes (00000)
Example: Cell B3 shows 000001566626872, so since this cell begins with 000001, then only display 1566626872.

If text in cell begins with 000005, then display the original value without the preceding five zeroes (00000)
Example: Cell B4 shows 000005353098164, so since this cell begins with 000005, then only display 5353098164.

I appreciate any input, thanks!!

1653072598035.png
 

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.
How about
++Fluff.xlsm
ABC
1
20000008530X414000008530X4140
30000015666268721566626872
40000053530981645353098164
Data
Cell Formulas
RangeFormula
C2:C4C2=IF(LEFT(B2,6)="000000",MID(B2,3,LEN(B2)),IF(OR(LEFT(B2,6)={"000001","000005"}),MID(B2,6,LEN(B2)),B2))
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Excel formula to remove a certain number of characters IF...
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,215,085
Messages
6,123,030
Members
449,092
Latest member
ikke

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