Help with Substitute on Multiple variable

tbruce

Board Regular
Joined
Dec 9, 2013
Messages
77
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm trying to write a formula that will replace all the 3's with 4, all the 2's with 3, and all the 1's with 2, but need to do it in this order so it does the 3s first, then the 2s, then the 1s, that way it doesn't apply it twice to the number. The digit is in the first position from the left (e.g. 13029344, 23029344,33029344). Is there a way to do this with a formula? Any help would be appreciated.

Here is what I have for the first change which works, but can't figure out how to get the second and third variables changed with the same formula =SUBSTITUTE(B2,"3","4",1)
 
Ok both of these appear to work - still validating. One this I need to do is also pull in the "0" value if present. So if the value in the cell is ZERO, go ahead and pull that in as ZERO. Any help for this last piece would be much appreciated
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Actually the second example pulls in the ZEROs so thank you everyone it looks like both work for the first value only.
 
Upvote 0
One this I need to do is also pull in the "0" value if present.
Does that mean the original values are text?
If so, and the results are to be text, omit the double negation at the start of my formula.

20 09 09.xlsm
AB
13013940139
22013930139
31013920139
43013940139
53013940139
65555555555
70265902659
800
Substitute
Cell Formulas
RangeFormula
B1:B8B1=REPLACE(A1,1,1,LEFT(A1,1)+OR(--LEFT(A1,1)={1,2,3}))
 
Upvote 0

Forum statistics

Threads
1,216,102
Messages
6,128,853
Members
449,471
Latest member
lachbee

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