Need help replacing text after the the 9th underscore

ScoobyChoo

New Member
Joined
May 15, 2023
Messages
4
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello! Got an interesting situation I am looking to resolve
So I have a naming convention that uses underscore to separate out different perimeters
Name_Location_Type_Location_Volume_Channel_Delivery_Supply_Quantity_Top Level Description_Mid Level Description_Low Level Description_Code_Language

Is there a formula that I can use that will search this cell and replace everything after the 9th underscore and replace everything that follows with a different text?
so it an example would like:
Name_Location_Type_Location_Volume_Channel_Delivery_Supply_Quantity_1_2_3_4_5 ->
Name_Location_Type_Location_Volume_Channel_Delivery_Supply_Quantity_6_7_8_9_10
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi & welcome to MrExcel.
What exactly should the text be replaced with & why?
 
Upvote 0
Thanks!
The text should be replaced with an evergreen standard parameter, our naming convention is generally different for every single order placed but there will always be 1 consistent order that should exist, so in the example: Name_Location_Type_Location_Volume_Channel_Delivery_Supply_Quantity_6_7_8_9_10,
6_7_8_9_10 will always be a naming convention that is needed
So the idea to grab an existing text within in a cell, locate the 9th underscore and replace everything that follows with 6_7_8_9_10
 
Upvote 0
Sorry Fluff, didnt realize you were asking for the exact replacement. I was using the numbers as an example! Your post solves my problem perfectly, but can the actual text be "Customer Data_Homepage Visitors_Retarget_SS_English"
 
Upvote 0
Yup, you can use
Excel Formula:
=TEXTBEFORE(A2,"_",9)&"_Customer Data_Homepage Visitors_Retarget_SS_English"
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,154
Messages
6,123,327
Members
449,098
Latest member
thnirmitha

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