Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Excel > Excel Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 04-17-2019, 07:36 AM
limsp limsp is offline Windows 10 Office 2016
Novice
 
Join Date: Apr 2019
Posts: 1
limsp is on a distinguished road
Default Need help to create macro to find and replace if conditions are met

I need some help in creating vba/macro to find and replace if conditions are met.

PHP Code:
Col_A        Col_B        Col_C
aa            Depa        Depb
bb            Depa        Depc
bb            Depb        Depi
cc            Depc        Depj
cc            Depd        Depk
aa            Depc
aa            Deph
aa            Depj 

Condiitions:
1. If any value in column b match any of the list in column C
2. and column a is "aa",
3. then replace "aa" with "yy"


Thanks very much for the help.

Reply With Quote
  #2  
Old 04-19-2019, 06:45 AM
p45cal p45cal is online now Windows 10 Office 2016
Competent Performer
 
Join Date: Apr 2014
Posts: 238
p45cal will become famous soon enough
Default

Do you need a macro?
In row 2 of any column beyond column C:
Code:
=IF(AND(A2="aa",ISNUMBER(MATCH(B2,$C$1:$C$5,0))),"yy",A2)
copy down.

Then copy|paste-special values over column A.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and Replace Macro Need djpemberton Word VBA 2 05-04-2016 07:53 PM
Looking for code to create a macro that prompts user to enter text, then does a find/replace. sfvegas PowerPoint 0 01-08-2016 02:22 AM
Find and Replace Macro amparete13 PowerPoint 3 03-11-2014 05:29 AM
macro or find/replace JamesVenhaus Word 2 02-27-2012 03:34 PM
Find and Replace Macro - A Better Way Tribos Word VBA 0 10-08-2008 03:22 AM


All times are GMT -7. The time now is 08:55 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft