Replace with condition

ahmed Adel

New Member
Joined
May 25, 2024
Messages
2
Office Version
  1. 2021
  2. 2019
  3. 2010
  4. 2007
  5. 2003 or older
If the first initial or number = 2 replace it with 3099 and if 5 replace with 5440 any other number should stay with no effect

For ex
25756556756 should be 3099 cause starts with 2
24445556 should be 3099

36345 should be 36345

5383737 should be 5440
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You can use a combination of IF and LEFT.
Book1
AB
1
2257565567563099
3244455563099
43634536345
553837375440
Sheet5
Cell Formulas
RangeFormula
B2:B5B2=IF(--LEFT(A2,1)=2,3099,IF(--LEFT(A2,1)=5,5440,A2))
 
Upvote 0
Please post to this forum in English only. Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,330
Members
453,032
Latest member
Pauh

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