+ Reply to Thread
Results 1 to 3 of 3

IF statment logical operators

  1. #1
    Registered User
    Join Date
    08-05-2015
    Location
    Ohio
    MS-Off Ver
    2013
    Posts
    3

    IF statment logical operators

    I have four cells with the following data:

    A1=NA
    C1=NA
    E1=Hexes location 1
    G1=Perl Location 2

    I want to us an if statement and use the OR operator for cells A1 and C1 to match on "NA" and the And operator for cells E1 and G1 to find a match off the abbreviation "hex"

    /code/

    if(Or(A1="NA", C1="NA",And(E1="*Hex*", G1="*Hex*")),"true", "false")

    /code/

    What am i missing? Thanks.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: IF statment logical operators

    =OR(A1="NA", C1="NA",AND(ISNUMBER(SEARCH("Hex", E1)), ISNUMBER(SEARCH("Hex", G1))))

    will give True or False
    Your original values would return FALSE as both E1 and G1 must contain Hex
    I used SeARCH instead of FIND because it's not case sensitive.
    Is this what you wanted?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: IF statment logical operators

    The AND function doesn't support the use of wildcards.

    Replace the AND with something like this:

    COUNTIF(E1,"*Hex*")+COUNTIF(G1,"*Hex*")=2
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Use Logical Operators as Parameters in a VBA function
    By grazian2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-10-2014, 04:50 PM
  2. if with logical operators
    By dagobax in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-12-2014, 07:19 AM
  3. Combining Multiple if statements using logical operators
    By arahant16 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-24-2014, 03:49 AM
  4. Replies: 2
    Last Post: 05-13-2013, 02:41 AM
  5. [SOLVED] Can logical operators be used within Conditional Formatting?
    By Rumpa Biswas in forum Excel General
    Replies: 8
    Last Post: 12-03-2012, 03:23 AM
  6. Multiple Logical Operators
    By bluesstruggler in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-22-2011, 09:27 PM
  7. Syntax for Logical Operators to Limit Input?
    By DCSwearingen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2006, 11:14 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