Find and replace string in cell

trekker1218

Board Regular
Joined
Feb 15, 2018
Messages
86
Office Version
  1. 2019
Platform
  1. Windows
Hello,
I am trying to find and change a word with a cell with another word based on the value of another cell.

example:
4M690
4m690 V-belt Outside Length 69"
4M690
V-belt Outside Length 69" 4m690
4M690
V-belt Outside 4m690 Length 69"
4M690
V-belt Outside Length 4m690 69"
4L690
V-belt Outside Length 69"

I need to find the value in A1 and replace that string in B1. My basic problem is the upper and lower case issue. I tried find and replace but could not get it to work properly.
I only want to change the actual matching string from A1 in B1 the result would be this below.
4M690
4M690 V-belt Outside Length 69"
4M690
V-belt Outside Length 69" 4M690
4M690
V-belt Outside 4M690 Length 69"

I would like to use a VBA or condition formula if possible.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
It is always the lower-case changed to upper-case?
=SUBSTITUTE(B1,LOWER(A1),A1)
 
Upvote 0
Is there a way to make it work in a condition or vba without adding another column to insert your formula
 
Upvote 0
Try:

Code:
Sub Trekker()
Dim LR As Long, i As Integer, str As String

LR = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To LR
str = WorksheetFunction.Substitute(Range("B" & i), LCase(Range("A" & i)), Range("A" & i))
Cells(i, 2) = str
Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,779
Members
449,049
Latest member
greyangel23

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