Using replace to replace ONLY the first instance

cloud2828

New Member
Joined
Jul 16, 2019
Messages
43
I'm trying to use this formula:
REPLACE("S";1;1;"O")
To remove the first instance of S only. An example of what the column would look like:

[TABLE="width: 25"]
<tbody>[TR]
[TD]T[/TD]
[/TR]
[TR]
[TD]O[/TD]
[/TR]
[TR]
[TD]O[/TD]
[/TR]
[TR]
[TD]P[/TD]
[/TR]
[TR]
[TD]P[/TD]
[/TR]
[TR]
[TD]T[/TD]
[/TR]
[TR]
[TD]S[/TD]
[/TR]
[TR]
[TD]S[/TD]
[/TR]
[TR]
[TD]P[/TD]
[/TR]
[TR]
[TD]O[/TD]
[/TR]
[TR]
[TD]T[/TD]
[/TR]
[TR]
[TD]O[/TD]
[/TR]
[TR]
[TD]O
[/TD]
[/TR]
</tbody>[/TABLE]

Sadly, It is necessary that I drag the formula I have down thus resulting in all the "S" being replaced by "O".
 
Last edited:
Why not just write some VBA that reads your definition table and creates a column with said number of each letter. Add a random number in the adjacent column, sort by that column, then delete it.
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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