+ Reply to Thread
Results 1 to 5 of 5

VBA fill in cells in a new column in table based on multiple criteria from other columns

  1. #1
    Registered User
    Join Date
    03-12-2013
    Location
    Barcelona, Spain
    MS-Off Ver
    Excel 2010
    Posts
    2

    VBA fill in cells in a new column in table based on multiple criteria from other columns

    Hello Forum,

    I am super new to VBA, thus joining this forum for help, so please bear with me.

    I have an excel file with table data (columns A to AE already have data) and I am trying to create a new column at the end of the table (column AF) based on data that exists in columns M and X.

    I'm sorry, I would share the table, but it includes confidential information (I work in HR). The reason I need to do it in VBA is because this report will have to be populated monthly with the same criteria.

    So for example, I need to insert a "YES" or "NO" in cell AF2 if cell M2 and X2 say certain text.

    Can anyone please help me in writing this code?

    My premature coding skills are ask follows:


    If (Range("M").Text) = "Marketing" & (Range("X").Text) = "Amsterdam" or "The Hague" or "Deer Park" or "Sydney" or "Mumbai" or "Bhiwandi" or "Singapore" or "Silver Spring" Then
    Range("AF").Text = "YES"
    Else: Range("AF").Text = "NO"
    End If

    Thanks Forum!

    HRA

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: VBA fill in cells in a new column in table based on multiple criteria from other colum

    please express the criteria in detail (the values of Ms and Xs and the desired response)

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA fill in cells in a new column in table based on multiple criteria from other colum

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-12-2013
    Location
    Barcelona, Spain
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: VBA fill in cells in a new column in table based on multiple criteria from other colum

    Thank you so much John!! It worked exactly how I needed! You're a superstar!!

    Thanks!
    HRA

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA fill in cells in a new column in table based on multiple criteria from other colum

    You're welcome, glad it worked out for you. And thanks for the feedback. Please comply with Forum Rule No. 9.

    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

+ 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