+ Reply to Thread
Results 1 to 6 of 6

Is this proper syntax for a combined AND/OR If statement?

  1. #1
    Registered User
    Join Date
    11-03-2006
    MS-Off Ver
    365
    Posts
    63

    Is this proper syntax for a combined AND/OR If statement?

    I have a section of code that I can't seem to get working and I wondering if its just my syntax.

    Here's the problem portion
    Please Login or Register  to view this content.
    My code doesn't seem to look at the (thisRow,11) value.

    In general, is this the correct way to phrase a combined AND + OR statement?

    Thanks!

  2. #2
    Registered User
    Join Date
    07-02-2013
    Location
    Cheshire
    MS-Off Ver
    Office Professional 2007
    Posts
    79

    Re: Is this proper syntax for a combined AND/OR If statement?

    Hi there. It Totally depends on what you are trying to do. I guess from the snippet you posted that you are trying to see if you have a'US' in column 11 and then check for one of a set of values in column 6 (the OR bit). If that is the case, enclose all your ors within a set of brackets. So the line would be elseif condition1 AND (condition2 OR condition3 OR condition4 etc).

  3. #3
    Registered User
    Join Date
    11-03-2006
    MS-Off Ver
    365
    Posts
    63

    Re: Is this proper syntax for a combined AND/OR If statement?

    Quote Originally Posted by maclearyj View Post
    Hi there. It Totally depends on what you are trying to do. I guess from the snippet you posted that you are trying to see if you have a'US' in column 11 and then check for one of a set of values in column 6 (the OR bit). If that is the case, enclose all your ors within a set of brackets. So the line would be elseif condition1 AND (condition2 OR condition3 OR condition4 etc).
    Perfect, this works, thanks!!

  4. #4
    Registered User
    Join Date
    07-02-2013
    Location
    Cheshire
    MS-Off Ver
    Office Professional 2007
    Posts
    79

    Re: Is this proper syntax for a combined AND/OR If statement?

    You're welcome. If you haven't already please click on the Add Reputation star underneath my post (or this one).

  5. #5
    Registered User
    Join Date
    11-03-2006
    MS-Off Ver
    365
    Posts
    63

    Re: Is this proper syntax for a combined AND/OR If statement?

    Quote Originally Posted by maclearyj View Post
    You're welcome. If you haven't already please click on the Add Reputation star underneath my post (or this one).
    Sorry, I didn't know about the reputation system. Done!

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Is this proper syntax for a combined AND/OR If statement?

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    HTH
    Regards, Jeff

+ 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] Proper syntax to return an * in an IF statement
    By Pallando_II in forum Excel General
    Replies: 1
    Last Post: 02-22-2017, 08:31 PM
  2. Proper formula syntax for an AND statement?
    By redsab in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-21-2013, 10:58 AM
  3. Proper syntax for IF statement
    By L.LEE in forum Excel General
    Replies: 1
    Last Post: 12-30-2012, 11:11 AM
  4. Proper syntax for an If/Then statement
    By sparemail72 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2012, 09:25 AM
  5. Proper syntax for an IF statement
    By Stuart_Mansfield in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-23-2012, 01:52 PM
  6. Proper syntax for IF statement within macro
    By rap73 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-30-2012, 11:25 PM
  7. [SOLVED] Proper syntax for an If statement with OR
    By publius190 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-26-2012, 10:00 AM

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