# a formula that changes words in a cell

#### orinew1324

##### New Member
Hello there!
I have an excel sheet filled with cells that look like this:
[latex]{ x }^{ 2 }&gt;144[latex]מהו הטווח של איקס?
I want to replace the first [latex] with \begin{align} and the second [latex] with \end{align} and I would like it to happen over alot of cells in the excel sheet.
Is there any formula that could automaticlly do it for me?
again, thank you for your help guys!!

### Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

#### Peter_SSs

##### MrExcel MVP, Moderator
If the first [latex] is always followed by an "{" and the second ones are not like your sample ..

then

#### orinew1324

##### New Member
If the first [latex] is always followed by an "{" and the second ones are not like your sample ..

View attachment 9914

then

View attachment 9912
well actually the { that follows the first latex belongs to the fraction that is part of a math question for the students which means that replacing it will break the code for the question itself . is there another way to "target" the first [latex]?

again. thanks haha! your explanation is quite detailed and its amazing.

#### Peter_SSs

##### MrExcel MVP, Moderator
which means that replacing it will break the code for the question itself
If you look carefully, you will see that I included that "{" again in the 'Replace with:' box so it isn't actually removed at all.

Here is my test after I did the two suggested replacements. Isn't that what you wanted?