Need code or function to remove text

zubair99

New Member
Joined
Aug 8, 2015
Messages
49
I have the following data in column K in bookings sheet.

Dj Ian Duggan
Dj Ian O Sullivan
Briar Rose
Jason Nolan Apple Computers
Ingrid Homich Cork International Hotel
Mary Foley Mobile
Natasha Meteor
Emer Igbokwe PR Agency
Carol Crowley Bc Cobh
Paul O Leary Bc Crosshaven
Donal Mc Grath Bc Dungourney
James Mc Shane


Im looking for code to remove the yellow highlighted txt above.

Here are some of the rules

If first word = ‘dj’ remove this word

If 2nd word is not (“0” or “mc”)
{
Remove all words after second word
}
Else
{
Remove all words after 3rd word
}


Looking for somebody to write some code for this
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
nothing is highlighted yellow

Dj Ian Duggan
Dj Ian O Sullivan
Briar Rose
Jason Nolan Apple Computers
Ingrid Homich Cork International Hotel
Mary Foley Mobile
Natasha Meteor
Emer Igbokwe PR Agency
Carol Crowley Bc Cobh
Paul O Leary Bc Crosshaven
Donal Mc Grath Bc Dungourney
James Mc Shane
 
Upvote 0
As there is no logic to the text to be removed, I would suggest Text to Columns might be the best option.
Other posters might see a different method better than I
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,103
Members
452,379
Latest member
IainTru

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