+ Reply to Thread
Results 1 to 3 of 3

How to cluster together variables in an IF statement

  1. #1
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    How to cluster together variables in an IF statement

    Right now I have:

    Please Login or Register  to view this content.
    On a userform, there are a bunch of text boxes where you can enter in as many names as you want to search against X.

    For example, you could fill in the first three of the text boxes with "Jim" "John" and "Larry" and n1 would = Jim, n2 = John and n3 = Larry. So basically the formula is checking
    Please Login or Register  to view this content.
    What I would ALSO like to do, is have the ability for someone to enter in "James" in one of the text boxes.

    James is the supervisor of Jim, John, and Larry. So I want it to where if you only fill in one text box with the value of "James", the script would automatically have the formula checking to see if X = (Jim, John, or Larry).

    I get that I could just say
    Please Login or Register  to view this content.
    but I didn't know if there was an easier way to do this.

    I would like to cluster it even further, to where let's say I have "Alex", who is the boss of James, as well as "Frank".

    I would like entering "Alex" in one of the textboxes to automatically check the names of all subordinates under Frank and James against X. There may be continuing levels to this chain.

    I also would like to group it by department, such as "Finance" would check all the names in the Finance list against X.

    What is the easiest way to accomplish this?
    Last edited by ks100; 10-14-2014 at 11:12 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: How to cluster together variables in an IF statement

    Not sure what you mean by 'cluster' but I would start by using an array for the names you want to search/check for.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Re: How to cluster together variables in an IF statement

    Quote Originally Posted by Norie View Post
    Not sure what you mean by 'cluster' but I would start by using an array for the names you want to search/check for.
    Yes an array seems to make sense. How do I tell the script to do:

    Please Login or Register  to view this content.
    ?

+ 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. Set Variables With If Statement
    By w.m.christensen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2013, 12:10 AM
  2. [SOLVED] IF AND OR Statement with 4 variables
    By Webbers in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-24-2012, 03:03 PM
  3. IF Statement with 3 variables
    By garopro in forum Excel General
    Replies: 11
    Last Post: 09-29-2011, 12:23 PM
  4. Too many variables for an if than statement?
    By repke in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 05-02-2006, 12:01 PM
  5. [SOLVED] Use variables in sql statement
    By Markantesp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2005, 04:06 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