Not in excel

Not in excel DEFAULT

Excel logical operators: equal to, not equal to, greater than, less than

Many tasks you perform in Excel involve comparing data in different cells. For this, Microsoft Excel provides six logical operators, which are also called comparison operators. This tutorial aims to help you understand the insight of Excel logical operators and write the most efficient formulas for your data analysis.

Excel logical operators - overview

A logical operator is used in Excel to compare two values. Logical operators are sometimes called Boolean operators because the result of the comparison in any given case can only be either TRUE or FALSE.

Six logical operators are available in Excel. The following table explains what each of them does and illustrates the theory with formula examples.

ConditionOperatorFormula ExampleDescription
Equal to==A1=B1The formula returns TRUE if a value in cell A1 is equal to the values in cell B1; FALSE otherwise.
Not equal to<>=A1<>B1The formula returns TRUE if a value in cell A1 is not equal to the value in cell B1; FALSE otherwise.
Greater than>=A1>B1The formula returns TRUE if a value in cell A1 is greater than a value in cell B1; otherwise it returns FALSE.
Less than<=A1<B1The formula returns TRUE if a value in cell A1 is less than in cell B1; FALSE otherwise.
Greater than or equal to>==A1>=B1The formula returns TRUE if a value in cell A1 is greater than or equal to the values in cell B1; FALSE otherwise.
Less than or equal to<==A1<=B1The formula returns TRUE if a value in cell A1 is less than or equal to the values in cell B1; FALSE otherwise.

The screenshot below demonstrates the results returned by Equal to, Not equal to, Greater than and Less than logical operators:
Using Equal to, Not equal to, Greater than and Less than in Excel

It may seem that the above table covers it all and there's nothing more to talk about. But in fact, each logical operator has its own specificities and knowing them can help you harness the real power of Excel formulas.

Using "Equal to" logical operator in Excel

The Equal to logical operator (=) can be used to compare all data types - numbers, dates, text values, Booleans, as well as the results returned by other Excel formulas. For example:

=A1=B1Returns TRUE if the values in cells A1 and B1 are the same, FALSE otherwise.
=A1="oranges"Returns TRUE if cells A1 contain the word "oranges", FALSE otherwise.
=A1=TRUEReturns TRUE if cells A1 contain the Boolean value TRUE, otherwise it returns FALSE.
=A1=(B1/2)Returns TRUE if a number in cell A1 is equal to the quotient of the division of B1 by 2, FALSE otherwise.

Example 1. Using the "Equal to" operator with dates

You might be surprised to know that the Equal to logical operator cannot compare dates as easily as numbers. For example, if the cells A1 and A2 contain the date "12/1/2014", the formula will return TRUE exactly as it should.

However, if you try either or you will get FALSE as the result. A bit unexpected, eh?

The point is that Excel stores dates as numbers beginning with 1-Jan-1900, which is stored as 1. The date 12/1/2014 is stored as 41974. In the above formulas, Microsoft Excel interprets "12/1/2014" as a usual text string, and since "12/1/2014" is not equal to 41974, it returns FALSE.

To get the correct result, you must always wrap a date in the DATEVALUE function, like this
Using Excel's equal to operator with dates

Note. The DATEVALUE function needs to be used with other logical operator as well, as demonstrated in the examples that follow.

The same approach should be applied when you use Excel's equal to operator in the logical test of the IF function. You can find more info as well as a few formula examples in this tutorial: Using Excel IF function with dates.

Example 2. Using the "Equal to" operator with text values

Using Excel's Equal to operator with text values does not require any extra twists. The only thing you should keep in mind is that the Equal to logical operator in Excel is case-insensitive, meaning that case differences are ignored when comparing text values.

For example, if cell A1 contains the word "oranges" and cell B1 contains "Oranges", the formula will return TRUE.

If you want to compare text values taking in to account their case differences, you should use the EXACT function instead of the Equal to operator. The syntax of the EXACT function is as simple as:

Where text 1 and text2 are the values you want to compare. If the values are exactly the same, including case, Excel returns TRUE; otherwise, it returns FALSE. You can also use the EXACT function in IF formulas when you need a case-sensitive comparison of text values, as shown in the below screenshot:
Using the EXACT function for case-sensitive comparison of text values

Note. If you want to compare the length of two text values, you can use the LEN function instead, for example or .

Example 3. Comparing Boolean values and numbers

There is a widespread opinion that in Microsoft Excel the Boolean value of TRUE always equates to 1 and FALSE to 0. However, this is only partially true, and the key word here is "always" or more precisely "not always" : )

When writing an 'equal to' logical expression that compares a Boolean value and a number, you need to specifically point out for Excel that a non-numeric Boolean value should be treated as a number. You can do this by adding the double minus sign in front of a Boolean value or a cell reference, e. g. or .

The 1st minus sign, which is technically called the unary operator, coerces TRUE/FALSE to -1/0, respectively, and the second unary negates the values turning them into +1 and 0. This will probably be easier to understand looking at the following screenshot:
Comparing Boolean values and numbers

Note. You should add the double unary operator before a Boolean when using other logical operators such as not equal to, greater than or less than to correctly compare a numeric and Boolean values.

When using logical operators in complex formulas, you might also need to add the double unary before each logical expression that returns TRUE or FALSE as the result. Here's an example of such a formula: SUMPRODUCT and SUMIFS in Excel.

Using "Not equal to" logical operator in Excel

You use Excel's Not equal to operator (<>) when you want to make sure that a cell's value is not equal to a specified value. The use of the Not equal to operator is very similar to the use of Equal to that we discussed a moment ago.

The results returned by the Not equal to operator are analogous to the results produced by the Excel NOT function that reverses the value of its argument. The following table provides a few formula examples.

Not equal to operatorNOT functionDescription
=A1<>B1=NOT(A1=B1)Returns TRUE if the values in cells A1 and B1 are not the same, FALSE otherwise.
=A1<>"oranges"=NOT(A1="oranges")Returns TRUE if cell A1 contains any value other than "oranges", FALSE if it contains "oranges" or "ORANGES" or "Oranges", etc.
=A1<>TRUE=NOT(A1=TRUE)Returns TRUE if cell A1 contains any value other than TRUE, FALSE otherwise.
=A1<>(B1/2)=NOT(A1=B1/2)Returns TRUE if a number in cell A1 is not equal to the quotient of the division of B1 by 2, FALSE otherwise.
=A1<>DATEVALUE("12/1/2014")=NOT(A1=DATEVALUE("12/1/2014"))Returns TRUE if A1 contains any value other than the date of 1-Dec-2014, regardless of the date format, FALSE otherwise.

Greater than, Less than, Greater than or equal to, Less than or equal to

You use these logical operators in Excel to check how one number compares to another. Microsoft Excel provides 4 comparison operates whose names are self-explanatory:

  • Greater than (>)
  • Greater than or equal to (>=)
  • Less than (<)
  • Less than or equal to (<=)

Most often, Excel comparison operators are used with numbers, date and time values. For example:

=A1>20Returns TRUE if a number in cell A1 is greater than 20, FALSE otherwise.
=A1>=(B1/2)Returns TRUE if a number in cell A1 is greater than or equal to the quotient of the division of B1 by 2, FALSE otherwise.
=A1<DATEVALUE("12/1/2014")Returns TRUE if a date in cell A1 is less than 1-Dec-2014, FALSE otherwise.
=A1<=SUM(B1:D1)Returns TRUE if a number in cell A1 is less than or equal to the sum of values in cells B1:D1, FALSE otherwise.

Using Excel comparison operators with text values

In theory, you can also use the greater than, greater than or equal to operators as well as their less than counterparts with text values. For example, if cell A1 contains "apples" and B1 contains "bananas", guess what the formula will return? Congratulations to those who've staked on FALSE : )

When comparing text values, Microsoft Excel ignores their case and compares the values symbol by symbol, "a" being considered the lowest text value and "z" - the highest text value.

So, when comparing the values of "apples" (A1) and "bananas" (B1), Excel starts with their first letters "a" and "b", respectively, and since "b" is greater than "a", the formula returns FALSE.

If the first letters are the same, then the 2nd letters are compared, if they happen to be identical too, then Excel gets to the 3rd, 4th letters and so on. For example, if A1 contained "apples" and B1 contained "agave", the formula would return TRUE because "p" is greater than "g".
Using Excel comparison operators with text values

At first sight, the use of comparison operators with text values seems to have very little practical sense, but you never know what you might need in the future, so probably this knowledge will prove helpful to someone.

Common uses of logical operators in Excel

In real work, Excel logical operators are rarely used on their own. Agree, the Boolean values TRUE and FALSE they return, though very true (excuse the pun), are not very meaningful. To get more sensible results, you can use logical operators as part of Excel functions or conditional formatting rules, as demonstrated in the below examples.

1. Using logical operators in arguments of Excel functions

When it comes to logical operators, Excel is very permissive and allows using them in parameters of many functions. One of the most common uses is found in Excel IF function where the comparison operators can help to construct a logical test, and the IF formula will return an appropriate result depending on whether the test evaluates to TRUE or FALSE. For example:

This simple IF formula returns OK if a value in cell A1 is greater than or equal to a value in cell B1, "Not OK" otherwise.

And here's another example:

The formula compares the values in cells A1 and B1, and if A1 is not equal to B1, the sum of values in cells A1:C1 is returned, an empty string otherwise.

Excel logical operators are also widely used in special IF functions such as SUMIF, COUNTIF, AVERAGEIF and their plural counterparts that return a result based on a certain condition or multiple conditions.

You can find a wealth of formula examples in the following tutorials:

2. Using Excel logical operators in mathematical calculations

Of course, Excel functions are very powerful, but you don't always have to use them to achieve the desired result. For example, the results returned by the following two formulas are identical:

IF function:

Formula with logical operators:
Using Excel logical operators in mathematical calculations

I guess the IF formula is easier to interpret, right? It tells Excel to multiply a value in cell B2 by 10 if B2 is greater than C2, otherwise the value in B1 is multiplied by 5.

Now, let's analyze what the 2nd formula with the greater than and less than or equal to logical operators does. It helps to know that in mathematical calculations Excel does equate the Boolean value TRUE to 1, and FALSE to 0. Keeping this in mind, let's see what each of the logical expressions actually returns.

If a value in cell B2 is greater than a value in C2, then the expression B2>C2 is TRUE, and consequently equal to 1. On the other hand, B2<=C2 is FALSE and equal to 0. So, given that B2>C2, our formula undergoes the following transformation:

Formula with logical operators

Since any number multiplied by zero gives zero, we can cast away the second part of the formula after the plus sign. And because any number multiplied by 1 is that number, our complex formula turns into a simple =B2*10 that returns the product of multiplying B2 by 10, which is exactly what the above IF formula does : )

Obviously, if a value in cell B2 is less than in C2, then the expression B2>C2 evaluates to FALSE (0) and B2<=C2 to TRUE (1), meaning that the reverse of the described above will occur.

3. Logical operators in Excel conditional formatting

Another common use of logical operators is found in Excel Conditional Formatting that lets you quickly highlight the most important information in a spreadsheet.

For example, the following simple rules highlight selected cells or entire rows in your worksheet depending on a value in column A:

Less than (orange):

Greater than (green):
Using logical operator in Excel conditional formatting

For the detailed-step-by-step instructions and rule examples, please see the following articles:

As you see, the use of logical operators in Excel is intuitive and easy. In the next article, we are going to learn the nuts and bolts of Excel logical functions that allow performing more than one comparison in a formula. Please stay tuned and thank you for reading!

You may also be interested in

Sours: https://www.ablebits.com/office-addins-blog/2014/12/10/excel-not-equal-to-greater-than-less-than/

The IF function allows you to make a logical comparison between a value and what you expect by testing for a condition and returning a result if that condition is True or False.

  • =IF(Something is True, then do something, otherwise do something else)

But what if you need to test multiple conditions, where let’s say all conditions need to be True or False (AND), or only one condition needs to be True or False (OR), or if you want to check if a condition does NOT meet your criteria? All 3 functions can be used on their own, but it’s much more common to see them paired with IF functions.

Use the IF function along with AND, OR and NOT to perform multiple evaluations if conditions are True or False.

Syntax

  • IF(AND()) - IF(AND(logical1, [logical2], ...), value_if_true, [value_if_false]))

  • IF(OR()) - IF(OR(logical1, [logical2], ...), value_if_true, [value_if_false]))

  • IF(NOT()) - IF(NOT(logical1), value_if_true, [value_if_false]))

Argument name

Description

logical_test (required)

The condition you want to test.

value_if_true (required)

The value that you want returned if the result of logical_test is TRUE.

value_if_false (optional)

The value that you want returned if the result of logical_test is FALSE.

Here are overviews of how to structure AND, OR and NOT functions individually. When you combine each one of them with an IF statement, they read like this:

  • AND – =IF(AND(Something is True, Something else is True), Value if True, Value if False)

  • OR – =IF(OR(Something is True, Something else is True), Value if True, Value if False)

  • NOT – =IF(NOT(Something is True), Value if True, Value if False)

Examples

Following are examples of some common nested IF(AND()), IF(OR()) and IF(NOT()) statements. The AND and OR functions can support up to 255 individual conditions, but it’s not good practice to use more than a few because complex, nested formulas can get very difficult to build, test and maintain. The NOT function only takes one condition.

Examples of using IF with AND, OR and NOT to evaluate numeric values and text

Here are the formulas spelled out according to their logic:

Formula

Description

=IF(AND(A2>0,B2<100),TRUE, FALSE)

IF A2 (25) is greater than 0, AND B2 (75) is less than 100, then return TRUE, otherwise return FALSE. In this case both conditions are true, so TRUE is returned.

=IF(AND(A3="Red",B3="Green"),TRUE,FALSE)

If A3 (“Blue”) = “Red”, AND B3 (“Green”) equals “Green” then return TRUE, otherwise return FALSE. In this case only the first condition is true, so FALSE is returned.

=IF(OR(A4>0,B4<50),TRUE, FALSE)

IF A4 (25) is greater than 0, OR B4 (75) is less than 50, then return TRUE, otherwise return FALSE. In this case, only the first condition is TRUE, but since OR only requires one argument to be true the formula returns TRUE.

=IF(OR(A5="Red",B5="Green"),TRUE,FALSE)

IF A5 (“Blue”) equals “Red”, OR B5 (“Green”) equals “Green” then return TRUE, otherwise return FALSE. In this case, the second argument is True, so the formula returns TRUE.

=IF(NOT(A6>50),TRUE,FALSE)

IF A6 (25) is NOT greater than 50, then return TRUE, otherwise return FALSE. In this case 25 is not greater than 50, so the formula returns TRUE.

=IF(NOT(A7="Red"),TRUE,FALSE)

IF A7 (“Blue”) is NOT equal to “Red”, then return TRUE, otherwise return FALSE.

Note that all of the examples have a closing parenthesis after their respective conditions are entered. The remaining True/False arguments are then left as part of the outer IF statement. You can also substitute Text or Numeric values for the TRUE/FALSE values to be returned in the examples.

Here are some examples of using AND, OR and NOT to evaluate dates.

Examples of using IF with AND, OR and NOT to evaluate dates

Here are the formulas spelled out according to their logic:

Formula

Description

=IF(A2>B2,TRUE,FALSE)

IF A2 is greater than B2, return TRUE, otherwise return FALSE. 03/12/14 is greater than 01/01/14, so the formula returns TRUE.

=IF(AND(A3>B2,A3<C2),TRUE,FALSE)

IF A3 is greater than B2 AND A3 is less than C2, return TRUE, otherwise return FALSE. In this case both arguments are true, so the formula returns TRUE.

=IF(OR(A4>B2,A4<B2+60),TRUE,FALSE)

IF A4 is greater than B2 OR A4 is less than B2 + 60, return TRUE, otherwise return FALSE. In this case the first argument is true, but the second is false. Since OR only needs one of the arguments to be true, the formula returns TRUE. If you use the Evaluate Formula Wizard from the Formula tab you'll see how Excel evaluates the formula.

=IF(NOT(A5>B2),TRUE,FALSE)

IF A5 is not greater than B2, then return TRUE, otherwise return FALSE. In this case, A5 is greater than B2, so the formula returns FALSE.

Example of the Evaluate Formula Wizard

Using AND, OR and NOT with Conditional Formatting

You can also use AND, OR and NOT to set Conditional Formatting criteria with the formula option. When you do this you can omit the IF function and use AND, OR and NOT on their own.

From the Home tab, click Conditional Formatting > New Rule. Next, select the “Use a formula to determine which cells to format” option, enter your formula and apply the format of your choice.

Conditional Formatting > Edit Rule dialog showing the Formula method

Using the earlier Dates example, here is what the formulas would be.

Example of using AND, OR and NOT as Conditional Formatting tests

Formula

Description

=A2>B2

If A2 is greater than B2, format the cell, otherwise do nothing.

=AND(A3>B2,A3<C2)

If A3 is greater than B2 AND A3 is less than C2, format the cell, otherwise do nothing.

=OR(A4>B2,A4<B2+60)

If A4 is greater than B2 OR A4 is less than B2 plus 60 (days), then format the cell, otherwise do nothing.

=NOT(A5>B2)

If A5 is NOT greater than B2, format the cell, otherwise do nothing. In this case A5 is greater than B2, so the result will return FALSE. If you were to change the formula to =NOT(B2>A5) it would return TRUE and the cell would be formatted.

Note: A common error is to enter your formula into Conditional Formatting without the equals sign (=). If you do this you’ll see that the Conditional Formatting dialog will add the equals sign and quotes to the formula - ="OR(A4>B2,A4<B2+60)", so you’ll need to remove the quotes before the formula will respond properly.

Top of Page

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

See Also

Learn how to use nested functions in a formula

IF function

AND function

OR function

NOT function

Overview of formulas in Excel

How to avoid broken formulas

Detect errors in formulas

Keyboard shortcuts in Excel

Logical functions (reference)

Excel functions (alphabetical)

Excel functions (by category)

Sours: https://support.microsoft.com/en-us/office/using-if-with-and-or-and-not-functions-d895f58c-b36c-419e-b1f2-5c193a236d97
  1. Icon pack asus
  2. Cars 1 radiator springs toys
  3. Alarm sound effects
  4. Ummc parking office
  5. Conroe vacation resort

MS Excel: How to use the NOT Function (WS)

totn Excel Functions

This Excel tutorial explains how to use the Excel NOT function with syntax and examples.

Description

The Microsoft Excel NOT function returns the reversed logical value.

The NOT function is a built-in function in Excel that is categorized as a Logical Function. It can be used as a worksheet function (WS) in Excel. As a worksheet function, the NOT function can be entered as part of a formula in a cell of a worksheet.

Syntax

The syntax for the NOT function in Microsoft Excel is:

NOT( logical_value )

Parameters or Arguments

logical_value
An expression that either evaluates to TRUE or FALSE. If used with an expression of TRUE, then FALSE is returned. If used with an expression of FALSE, then TRUE is returned.

Returns

If the logical_value is TRUE, then the NOT function will return FALSE.
If the logical_value is FALSE, then the NOT function will return TRUE.

Applies To

  • Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Example (as Worksheet Function)

Let's look at some Excel NOT function examples and explore how to use the NOT function as a worksheet function in Microsoft Excel:

Microsoft Excel

Based on the Excel spreadsheet above, the following NOT examples would return:

=NOT(A2="techonthenet.com") Result: FALSE =NOT(TRUE) Result: FALSE =NOT(FALSE) Result: TRUE =NOT(A1<10) Result: FALSE =NOT(A2="Microsoft") Result: TRUE =NOT(5+1=7) Result: TRUE
Sours: https://www.techonthenet.com/excel/formulas/not.php
Excel Magic Trick 1226: Compare 2 Lists, Extract Items In List 2 That are NOT in List 1 (6 Examples)

NOT in Excel

NOT in Excel

NOT in Excel

NOT function is an inbuilt function that is categorized under the Logical Function; the logical function operates under a logical test. It is also called Boolean logic or function. Boolean functions are most commonly used along with or in conjunction with other functions, specifically along with conditional test functions (“IF’’ FUNCTION), to create formulas that can evaluate multiple parameters or criteria and produce desired results depending on that criteria. It is used as an individual function or part of the formula and other excel functions in a cell. E.G. with AND, IF & OR function. It returns the opposite value of a given logical value in the formula, NOT function is used to reverse a logical value. If the argument is FALSE, then TRUE is returned and vice versa.

Note: Use NOT function when you want to make sure a value is not equal to one Specific or particular value

It’s a worksheet function; it is also used as part of the formula in a cell along with other excel function

  • If given with the value TRUE, the Not function returns FALSE
  • If given with the value FALSE, the Not function returns TRUE

NOT Formula in Excel

Below is the NOT Formula in excel:

NOT formula in Excel

=NOT (logical) logical – A value that can be evaluated to TRUE or FALSE

The only parameter in the NOT function is a logical value.

The logical test or argument can be either entered directly, or it can be entered as a reference to a cell that contains a logical value, and it always returns the Boolean value (“TRUE” OR “FALSE”) only.

How to Use the NOT Function in Excel?

NOT Function in Excel is very simple and easy to use. Let us now see how to use the NOT function in excel with the help of some examples.

Example #1 – Excel NOT Function

Here a logical test is performed on the given set of values (Student score) by using the NOT function. Here, we will check which value is greater than or equal to 50.

In the table, we have 2 columns, the first column contains student score & the second column is the logical test column, where the NOT function is performed.

Result: It will return the reverse value if the value is greater than or equal to 50, then it will return FALSE and if the lesser than or equal to 50, it will return TRUE as output.

NOT in excel example 1-1

The result will be as given below:

NOT in excel example 1-2

Example #2 – Using NOT Function with ISBLANK

the logical test is performed on the H5 & H6 Cells by using the NOT Function along with ISBLANK function; here will check if cells H5 & H6 is blank OR not using NOT function along with ISBLANK in excel

NOT Function with ISBLANK

OUTPUT will be TRUE.

NOT example 2-1

Example #3 – NOT Function along with “IF” and “OR” Function

Here the color check is performed for the cars in the below-mentioned table by using NOT Function along with “if” and “or” function

Here we have to sort out color “WHITE” or “RED” from the given set of data

=IF(NOT(OR(H11=”RED”,H11=”WHITE”)),”x”,””) formula is used

This logical condition is applied on a Color column containing any car with color “RED” or “WHITE”,

if the condition is true, then it will return blank as output,

NOT example 3

if not true, then it will return x as output

NOT example 3-1

Example #4 – VALUE! Error

It Occurs when the supplied argument is not a logical or numeric value.

Suppose, if we give a range in the logical argument

Selected the range C22:D22 in the logical argument, i.e. =NOT (C22:D22)

a function returns a #VALUE error because the NOT function does not allow any range and can take only a logical test or argument or one condition.

NOT example 4

Example #5 – NOT Function for an empty cell or blank or “0”

An empty cell or blank or “0” are treated as false, therefore “NOT” function returns TRUE

Here in the cell “I23”, the stored value is “0” suppose if I apply the “NOT” function with logical argument or value as “0” or “I23”, Output will be TRUE.

NOT example 5

Example #6 – NOT Function for Decimals

When the value is decimal in a cell

Suppose if we take the argument as decimals, i.e. suppose if I apply the “NOT” function with logical argument or value as “225.25” or “c27”, Output will be FALSE.

NOT Function for Decimals

Example #7 – NOT Function for Negative Number

When the value is a negative number in a cell

Suppose if we take the argument as a negative number, i.e. suppose if I apply the “NOT” function with logical argument or value as “-4” or “H27”, Output will be FALSE.

NOT example 7

Example #8 – When the value or Reference is Boolean Input in NOT Function

When the value or reference is Boolean input (“TRUE” OR “FALSE”) in a cell.

Here in the cell “C31”, the stored value is “TRUE” suppose if I apply the “NOT” function with logical argument or value as “C31” or “TRUE”, Output will be FALSE. It will be vice versa if the logical argument is “FALSE”, i.e. the NOT function returns the “TRUE” value as output.

NOT example 8

Recommended Articles

This has been a guide to NOT Function. Here we discuss the NOT Formula and how to use the NOT function along with practical examples and downloadable excel templates. You can also go through our other suggested articles –

  1. FV Function in Excel
  2. LOOKUP in Excel
  3. Not Equal To Excel
  4. Write Formula in Excel
Sours: https://www.educba.com/not-in-excel/

In excel not

Use the NOT function, one of the logical functions, when you want to make sure one value is not equal to another.

Example

Examples of the NOT function to reverse arguments.  E.G. =NOT(1+1=2)

The NOT function reverses the value of its argument.

One common use for the NOT function is to expand the usefulness of other functions that perform logical tests. For example, the IF function performs a logical test and then returns one value if the test evaluates to TRUE and another value if the test evaluates to FALSE. By using the NOT function as the logical_test argument of the IF function, you can test many different conditions instead of just one.

Syntax

NOT(logical)

The NOT function syntax has the following arguments:

  • Logical    Required. A value or expression that can be evaluated to TRUE or FALSE.

Remarks

If logical is FALSE, NOT returns TRUE; if logical is TRUE, NOT returns FALSE.

Examples

Here are some general examples of using NOT by itself, and in conjunction with IF, AND and OR.

Examples of NOT with IF, AND and OR functions

Formula

Description

=NOT(A2>100)

A2 is NOT greater than 100

=IF(AND(NOT(A2>1),NOT(A2<100)),A2,"The value is out of range")

50 is greater than 1 (TRUE), AND 50 is less than 100 (TRUE), so NOT reverses both arguments to FALSE. AND requires both arguments to be TRUE, so it returns the result if FALSE.

=IF(OR(NOT(A3<0),NOT(A3>50)),A3,"The value is out of range")

100 is not less than 0 (FALSE), and 100 is greater than 50 (TRUE), so NOT reverses the arguments to TRUE/FALSE. OR only requires one argument to be TRUE, so it returns the result if TRUE.

Sales Commission Calculation

Here is a fairly common scenario where we need to calculate if sales people qualify for a bonus using NOT with IF and AND.

Example of calculating a sales bonus with IF, AND, and NOT.  Formula in cell E14 is =IF(AND(NOT(B14<$B$7),NOT(C14<$B$5)),B14*$B$8,0)
  • =IF(AND(NOT(B14<$B$7),NOT(C14<$B$5)),B14*$B$8,0)- IF Total Sales is NOT less than Sales Goal, AND Accounts are NOT less than the Account Goal, then multiply Total Sales by the Commission %, otherwise return 0.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Related Topics

Video: Advanced IF functions
Learn how to use nested functions in a formula
IF function
AND function
OR function
Overview of formulas in Excel
How to avoid broken formulas
Use error checking to detect errors in formulas
Keyboard shortcuts in Excel
Logical functions (reference)
Excel functions (alphabetical)
Excel functions (by category)

Sours: https://support.microsoft.com/en-us/office/not-function-9cfc6011-a054-40c7-a140-cd4ba2d87d77
Don't Use Excel Filters! Use This Incredible Excel Formula Instead ...

Not Equal To

In Excel, <> means not equal to. The <> operator in Excel checks if two values are not equal to each other. Let's take a look at a few examples.

1. The formula in cell C1 below returns TRUE because the text value in cell A1 is not equal to the text value in cell B1.

Not Equal To Operator

2. The formula in cell C1 below returns FALSE because the value in cell A1 is equal to the value in cell B1.

False

3. The IF function below calculates the progress between a start and end value if the end value is not equal to an empty string (two double quotes with nothing in between), else it displays an empty string (see row 5).

If Not Equal To Empty String

Note: visit our page about the IF function for more information about this Excel function.

4. The COUNTIF function below counts the number of cells in the range A1:A5 that are not equal to "red".

Count Cells Not Equal To Red

Note: visit our page about the COUNTIF function for more information about this Excel function.

5. The COUNTIF function below produces the exact same result. The & operator joins the 'not equal to' operator and the text value in cell C1.

Concatenate 'Not Equal To' Operator and Cell Value

6. The COUNTIFS function below counts the number of cells in the range A1:A5 that are not equal to "red" and not equal to "blue".

Count Cells Not Equal To Red and Blue

Explanation: the COUNTIFS function in Excel counts cells based on two or more criteria. This COUNTIFS function has 2 range/criteria pairs.

7. The AVERAGEIF function below calculates the average of the values in the range A1:A5 that are not equal to 0.

Average Cells Not Equal To Zero

Note: in other words, the AVERAGEIF function above calculates the average excluding zeros.

Sours: https://www.excel-easy.com/examples/not-equal-to.html

You will also like:

.



130 131 132 133 134