+ Reply to Thread
Results 1 to 6 of 6

Using AND logical operator in IF statement

  1. #1
    Registered User
    Join Date
    08-01-2017
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    2016 / office365
    Posts
    43

    Using AND logical operator in IF statement

    Hi,

    I try to use a combined if statement. The result is not correct, and I think I did the formula the right way.

    code in column K: =IF((AND(O2="Einbaurahmen";F2>2));1)

    Thanks for the help!

    Andraž
    Attached Files Attached Files

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Using AND logical operator in IF statement

    Change it to:
    =IF(AND(SEARCH("Einbaurahmen",O2),F2>2),1,"Conditions not met")
    Replace "Conditions not met" with what you want. THis is supposed to be in case that bhose 2 conditions are not met.

  3. #3
    Registered User
    Join Date
    08-01-2017
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    2016 / office365
    Posts
    43

    Re: Using AND logical operator in IF statement

    @PaulM100 what if I want to embed another IF.. I only get a result of the first cell.

    when I copy I still get the errors...

    code: =IF(AND(SEARCH("Einbaurahmen";O2);F2>2);1;IF(AND(SEARCH("Aluprofil ";O2);F2>3);4;0))

    in my excel the comma is replaced by ";"

  4. #4
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Using AND logical operator in IF statement

    Try this
    Please Login or Register  to view this content.
    First IF condition takes in consideration if both words are present in O2, remove it if not necessary. But keep in mind that if you do so and you have both words in the same cell, then the returned value is 4 as this is the first condition. I've added first because 3 is greater than 2, so I thought that you need this first. I've also wrapped the formula in a IFERROR to sustain any issues that may occur. If you need to check the errors that do not meet the condition, then remove that part as well.

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,908

    Re: Using AND logical operator in IF statement

    Quote Originally Posted by apoje View Post
    code: =IF(AND(SEARCH("Einbaurahmen";O2);F2>2);1;IF(AND(SEARCH("Aluprofil ";O2);F2>3);4;0))
    Try this:

    =IF(COUNTIF(O2;"*Einbaurahmen*")*F2>2;1;IF(COUNTIF(O2;"*Aluprofil*")*F2>3;4;0))

  6. #6
    Registered User
    Join Date
    08-01-2017
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    2016 / office365
    Posts
    43

    Re: Using AND logical operator in IF statement

    @PaulM100 I tried like this and now it works

    Formula: copy to clipboard
    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. Logical Operator Date Comparison
    By chandramouliarun in forum Excel General
    Replies: 1
    Last Post: 04-28-2017, 05:26 PM
  2. In VBA want to use “>21” as a value not as a logical operator
    By vikyvivek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2016, 10:52 AM
  3. [SOLVED] Logical Formula with comparison operator not behaving as expected
    By attal in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-26-2013, 02:13 PM
  4. Replies: 3
    Last Post: 07-25-2012, 09:32 AM
  5. Logical Operator Syntax
    By bluesstruggler in forum Excel General
    Replies: 4
    Last Post: 06-08-2011, 12:06 PM
  6. [SOLVED] Logical operator inconsistency
    By KD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2006, 09:20 AM
  7. Formula checking multiple worksheets:logical operator
    By sonic-the-mouse in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-06-2005, 02:05 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