+ Reply to Thread
Results 1 to 8 of 8

Find and Replace Text in Formula based on condition

  1. #1
    Registered User
    Join Date
    05-05-2023
    Location
    United Arab Emirates
    MS-Off Ver
    Microsoft 365
    Posts
    16

    Find and Replace Text in Formula based on condition

    Hi, How to write a VBA code to go through a range of cells where formulas exist to find a text and replace with other text based on condition and value in another table. I have attached excel file for clarity. Thanks for your support in advance
    Attached Files Attached Files

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Find and Replace Text in Formula based on condition

    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    05-05-2023
    Location
    United Arab Emirates
    MS-Off Ver
    Microsoft 365
    Posts
    16

    Re: Find and Replace Text in Formula based on condition

    Attachment 828188

    Want it to be a loop to check for condition in column a value matching column d value then take replacement text from column B. Here is try to code.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Find and Replace Text in Formula based on condition

    You say...
    VBA will text in formula from range E10:F18 and look for value in condition table and replace $F$ with $C$ in the formula
    Attachment not working...You only have one value so why a loop...Upload a sample file that accurately represents your requirement showing a before | after result

    I think i have an idea of what you are trying with this but your layout does not add up...
    Please Login or Register  to view this content.

    Try this...
    Please Login or Register  to view this content.
    Last edited by sintek; 05-05-2023 at 08:51 AM.

  5. #5
    Registered User
    Join Date
    05-05-2023
    Location
    United Arab Emirates
    MS-Off Ver
    Microsoft 365
    Posts
    16

    Re: Find and Replace Text in Formula based on condition

    My bad....I changed the cell reference for my simplicity to code.
    attached the update sheet the before and after results for your reference. I will give the code you shared a try and get back to you.
    Attached Files Attached Files

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Find and Replace Text in Formula based on condition

    Amended code in post 4 solves

  7. #7
    Registered User
    Join Date
    05-05-2023
    Location
    United Arab Emirates
    MS-Off Ver
    Microsoft 365
    Posts
    16

    Re: Find and Replace Text in Formula based on condition

    Worked perfectly! This is exactly what I needed. Thanks a lot bro

    Try this...
    Please Login or Register  to view this content.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Find and Replace Text in Formula based on condition

    Glad to have helped...Tx for rep +

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Find and replace text in a string based on a condition
    By Grilleman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-02-2019, 06:56 PM
  2. replace text based on condition in excel
    By notbanme in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-25-2016, 10:12 AM
  3. [SOLVED] Find text based on condition
    By ganeshkumar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-24-2016, 12:00 PM
  4. Find and Replace text in formula based on sheet name
    By Arkman in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-07-2014, 06:12 AM
  5. find in excel replace in word: find/replace text in text boxes and headers
    By dean.rogers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-10-2012, 12:40 PM
  6. Find and replace based on condition macro
    By contra76 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-25-2010, 10:58 PM
  7. Find and Replace Text with If Then Condition
    By charliechez in forum Excel General
    Replies: 1
    Last Post: 11-07-2006, 12:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1