+ Reply to Thread
Results 1 to 4 of 4

Find value with multiple variables and change value in other column

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Find value with multiple variables and change value in other column

    Please see attached example book.

    In it I want to change name "G" in column A to "X" in column C.
    And I want to do it for month of May in column B.

    So a match won't do the trick because Name G is in 3 times so it should match on G and May from columns A and B.

    How to catch this in a simple VBA line?
    Thanks!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Find value with multiple variables and change value in other column

    loop through and then

    if range("A" & rowNum).value="G" and range("B" & rowNum).value="May" then
        range("C" & rowNum).value="X"
    end if
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Re: Find value with multiple variables and change value in other column

    Hmm yeah that could be a fairly simple solution which I did not think of.

    But can it not be done via a match or find on the ranges?
    I can make the loop but trying to avoid looping thru all lines.
    The example has not that many lines but the real workbook could contain a lot of lines in the end.

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Find value with multiple variables and change value in other column

    No, cause you're doing a find and replace, match will just do the find, and you need to match 2 columns, you could have column c hidden and do it with an IF formula.

    You could do it with find on column B for May, then column A for G, then do the neccessary, then do the find again from the previous found cell.

+ 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. Replies: 1
    Last Post: 05-12-2014, 10:25 PM
  2. [SOLVED] Find value in a column with certain variables
    By Even in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-02-2013, 05:13 AM
  3. Multiple Variables in a single column
    By ExcelHelp813 in forum Excel General
    Replies: 1
    Last Post: 05-23-2012, 02:40 PM
  4. Sum a column with multiple variables
    By allykid in forum Excel General
    Replies: 3
    Last Post: 03-09-2011, 02:22 PM
  5. Excel 2007 : Find Multiple Variables
    By Rachel86 in forum Excel General
    Replies: 1
    Last Post: 12-09-2009, 08:09 PM

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