+ Reply to Thread
Results 1 to 2 of 2

conditional find and replace

  1. #1
    Registered User
    Join Date
    01-30-2007
    Posts
    48

    conditional find and replace

    I need to figure out how to write a macro that will automatically evaluate text in one column and then change text in a second column if a condition is true.

    If Column B contains "Duck", and column A contains "Fowl", replace "Fowl" in column A with "WaterFowl". Of course, if column B did not contain "Duck" it would evaluate next row.

    This macro will be used on more than 250,000 records on a monthly basis, so using Autofilter would be impractical. There is a large, but definitive list of values to evaluate column B for, and a smaller, but still definitive list of conditions in the A column.

    Am I being too hopeful????

    Thanks!

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Digger442
    I need to figure out how to write a macro that will automatically evaluate text in one column and then change text in a second column if a condition is true.

    If Column B contains "Duck", and column A contains "Fowl", replace "Fowl" in column A with "WaterFowl". Of course, if column B did not contain "Duck" it would evaluate next row.

    This macro will be used on more than 250,000 records on a monthly basis, so using Autofilter would be impractical. There is a large, but definitive list of values to evaluate column B for, and a smaller, but still definitive list of conditions in the A column.

    Am I being too hopeful????

    Thanks!
    sounds confusing, if Duck is in A and B is the data you need a list of 3 other columns being Duck - Fowl - Waterfowl

    then just loop through rows, test A against the Duck column, if true check B against the Fowl column, if true replace with the entry in the Waterfowl column, then next row.

    If you have Excel 2007 the 250,000 rows shouldn't be a problem either.

    hth
    ---
    Si fractum non sit, noli id reficere.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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