Find and replace question

Routus

New Member
Joined
Mar 7, 2019
Messages
15
Office Version
  1. 2021
Platform
  1. Windows
Hi all

Can someone advise me how to solve this challenge please?

I have an Excel workbook with around 25k rows, and I want to replace the contents of cells in column K with something I can quickly search.

Here is an example of one of the cells contents:

"Go Racing With Vickers.Bet National Hunt Flat Race (Conditional/Amateurs') (Cat 1 Elimination) (GBB)"

In this example I want to delete everything to the left and right of 'National Hunt Flat', and replace 'National Hunt Flat' with 'NHF'


There are probably around 20 combinations of words that I want to treat this way, but if someone would be kind enough to explain how I can do this one (I'm not an Excel expert) with a formula, or create a process to do it, I can then modify it to accommodate all of the other variants.

Many thanks

Paul

 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi all

Can someone advise me how to solve this challenge please?

I have an Excel workbook with around 25k rows, and I want to replace the contents of cells in column K with something I can quickly search.

Here is an example of one of the cells contents:

"Go Racing With Vickers.Bet National Hunt Flat Race (Conditional/Amateurs') (Cat 1 Elimination) (GBB)"

In this example I want to delete everything to the left and right of 'National Hunt Flat', and replace 'National Hunt Flat' with 'NHF'


There are probably around 20 combinations of words that I want to treat this way, but if someone would be kind enough to explain how I can do this one (I'm not an Excel expert) with a formula, or create a process to do it, I can then modify it to accommodate all of the other variants.

Many thanks

Paul

I have figured this out now.
 
Upvote 0
use this VBA Code,
if u need help, le me know
thanks

Sub Replace()

'Rename with ur Sheet name
Dim S1 As Worksheet
Set S1 = ThisWorkbook.Sheets("Sheet1")



Dim i As Integer

'Change with ur 20 Combination word Column
For i = 1 To Application.CountA(S1.Range("O:O"))


'Action to replace 20 combination word of "National Hunt Flat" with "NHF"
S1.Range("K:K").Replace What:=S1.Range("O:O").Value, Replacement:="NHF"


Next i

MsgBox "Done"

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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