Find & Replace With A Twist

VitesseCarOwner

Board Regular
Joined
Jun 29, 2012
Messages
79
I have two columns of data 'A' and 'M'. In column 'A' where the first three characters are 1Q_ I Need to replace with "1QT_" but only if the corresponding cell in column 'M' has the value "Day D". Can anyone help? In the table below the 4th entry would require updating.

Column AColumn M
1Q_ABCDay B
2Q_ABCDay D
3Q_HGFDay C
6Q_POIDay B
1Q_ABCDay D
2Q_ABCDay C
3Q_HGFDay B




<tbody>
</tbody><colgroup><col><col></colgroup>
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I think this requires a VBA solution, Godsaint: your formula would have to sit in another column, whereas the OP has asked for a solution to "replace" what is in column A.
 
Upvote 0
this should do the trick

Code:
Sub test()
Dim add As String, addr As String
Let add = "A1:A" & Range("A" & Rows.Count).End(xlUp).Row
Let addr = "M1:M" & Range("M" & Rows.Count).End(xlUp).Row
Range(add).Value = Evaluate("IF(" & addr & "=""Day D"",SUBSTITUTE(" & add & ",""1Q_"",""1QT_"")," & add & ")")
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,178
Members
449,071
Latest member
cdnMech

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