Formula help

excelesha

Board Regular
Joined
Apr 19, 2023
Messages
65
Office Version
  1. 365
Platform
  1. Windows
Hello, please I am trying to replace the "4" that comes right after the lettes to "5", but the position of the 4 changes depending on the number of letter in front of it:
Unit 4Unit 5
27BFWW470127BFWW5701
27BD451427BD5514
27AEUEA421427AEUEA5214

I have about 2000 rows that I need to modify to "5". The thing that is consistent is that the 4 comes right after the letters. Thank you in advance.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi @excelesha. Thanks for posting on the board.

If the letters always start from the third position, then:
Dante Amor
AB
1Unit 4Unit 5
227BFWW470127BFWW5701
327BD451427BD5515
427AEUEA421427AEUEA5215
542AS12342AS123
642AS43242AS532
Hoja4
Cell Formulas
RangeFormula
B2:B6B2=LEFT(A2,2)&SUBSTITUTE(MID(A2,3,99),"4","5")


--------------
I hope to hear from you soon.
Respectfully
Dante Amor
--------------
 
Upvote 1
Thank you so much for replying!

The formula doesn't work if i have another 4 in the cell, see below:
27BD4604>>>>changes to 27BD5605, but I need 27BD5604
 
Upvote 0
Assuming you will never have a 4 before the letters, how about
Fluff.xlsm
AB
1Unit 4Unit 5
227BFWW470127BFWW5701
327BD451427BD5514
427AEUEA421427AEUEA5214
Main
Cell Formulas
RangeFormula
B2:B4B2=REPLACE(A2,FIND("4",A2),1,5)
 
Upvote 1
The formula doesn't work if i have another 4 in the cell, see below:

The formula also considers in case there is no 4. Try this

Dante Amor
AB
1Unit 4Unit 5
227BFWW470127BFWW5701
327BD451427BD5514
427AEUEA421427AEUEA5214
542AS12342AS123
642AS43242AS532
727BD460427BD5604
Hoja4
Cell Formulas
RangeFormula
B2:B7B2=LEFT(A2,2)&SUBSTITUTE(MID(A2,3,99),"4","5",1)


The change is small, just add this part:
=LEFT(A2,2)&SUBSTITUTE(MID(A2,3,99),"4","5",1)

;)
 
Upvote 1
Solution
OMG. you guys are AMAZING, @DanteAmor @Fluff , both formulas work! This is total genius, i thought it wouldn't be possible! Thank you so much!!!! Made my work so much faster and efficient.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
OMG. you guys are AMAZING, @DanteAmor @Fluff , both formulas work! This is total genius, i thought it wouldn't be possible! Thank you so much!!!! Made my work so much faster and efficient.
The formula also considers in case there is no 4. Try this

Dante Amor
AB
1Unit 4Unit 5
227BFWW470127BFWW5701
327BD451427BD5514
427AEUEA421427AEUEA5214
542AS12342AS123
642AS43242AS532
727BD460427BD5604
Hoja4
Cell Formulas
RangeFormula
B2:B7B2=LEFT(A2,2)&SUBSTITUTE(MID(A2,3,99),"4","5",1)


The change is small, just add this part:
=LEFT(A2,2)&SUBSTITUTE(MID(A2,3,99),"4","5",1)

;)
Thank again.

Is it possible to modify the formula further to include instances with 27ADE-4546 to be changed to 27ADE-5546, so basically the alphabets have a - then the 4 which is to be changed to 5. There are many cells in between that have a - after the alphabets.....

27BFWW470127BFWW5701
27BD451427BD5514
27AEUEA421427AEUEA5214
27ADE-454627ADE-5546
 
Upvote 0

Forum statistics

Threads
1,216,350
Messages
6,130,139
Members
449,560
Latest member
mattstan2012

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