Extraction of substring

Kiara12

New Member
Joined
May 6, 2023
Messages
2
Office Version
  1. 2021
Platform
  1. Windows
Hi, Wishing you a great day .
I am trying to extract a substring from a cell starting from character '!' till the end of the text in that cell and replace it with another text where I want a particular filed in the text to reference its corresponding another cell value.


For instance lets say this is a sample

1683346608818.png


Now here I want to select the text from ! Till the end of the string in cell B2 and replace it with How123you , that is it should take the value from cell A2 in cell C2. How can we write a formula for this.

How(value incolumn A)you does not come from any of the cells in the Table is just a string that I want to substitute in place of the extracted string from B2. and () should have the value from cell A2 and the result in c2,c3 should look like HelloHow123you
BHow456you
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Welcome to the MrExcel board!

See if this helps.

23 05 06.xlsm
ABC
1
2123Hello!WorldHelloHow123you
3456B!right livesBHow456you
Swap text
Cell Formulas
RangeFormula
C2:C3C2=LEFT(B2,FIND("!",B2)-1)&"How"&A2&"you"
 
Upvote 0
Hi
What about another option
Excel Formula:
=SUBSTITUTE(B2,"!","")&A2&"You"
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

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