ZetCode

Excel NOT Function

last modified October 5, 2026

The NOT function is a logical function in Excel that reverses the value of its argument. It returns TRUE when given FALSE and FALSE when given TRUE. This tutorial provides a comprehensive guide to using the NOT function with detailed examples. You'll learn basic syntax, how numbers and text are treated, and how to combine NOT with other functions.

NOT Function Basics

The NOT function is one of Excel's logical functions that performs a simple but essential operation: it reverses the logical value of its argument. It's particularly useful in conditional tests and logical expressions where you need the opposite of a condition.

Component Description
Function Name NOT
Syntax =NOT(logical)
Arguments 1 logical expression or value
Return Value Reversed logical value (TRUE/FALSE)

This table breaks down the essential components of the NOT function. It shows the function name, basic syntax format, argument requirements, and return value characteristics.

Argument Required Meaning
logical Yes A value or expression that can be evaluated to TRUE or FALSE. It can be the logical constants TRUE and FALSE, a comparison such as A1>10, a number, a cell reference, or another logical function.

NOT takes exactly one argument. Supplying a second argument produces a "too many arguments" error, and supplying none produces an error as well.

NOT Truth Table

The following table shows how NOT interprets the values that are commonly passed to it. A number is treated as FALSE when it is zero and as TRUE for every other value.

logical argument Value used by NOT Result
TRUE TRUE FALSE
FALSE FALSE TRUE
0 FALSE TRUE
1 TRUE FALSE
5 or -1 (any non-zero number) TRUE FALSE
Blank cell reference FALSE TRUE
Text #VALUE! #VALUE!

The table makes the core rule clear: NOT only ever returns TRUE or FALSE, and it returns the exact opposite of the logical value it is given. Text is the one input that cannot be interpreted as a logical value and therefore produces an error.

Basic NOT Example

This example demonstrates the simplest use of the NOT function with direct logical values.

Basic NOT formula
=NOT(TRUE)
=NOT(FALSE)

The first formula takes the logical value TRUE and returns its opposite, FALSE. The second takes FALSE and returns TRUE. Together they show the fundamental operation of the NOT function: reversing logical values.

NOT with Cell References

A more practical use of NOT involves referencing cells containing logical values. Here's an example with cell references.

A B
TRUE
=NOT(A1)

The table shows a simple spreadsheet with a logical value in cell A1 and a NOT formula in cell B2 that reverses the value from A1.

NOT with cell reference
=NOT(A1)

This formula reverses the logical value in cell A1. Since A1 contains TRUE, the result will be FALSE. Using cell references makes NOT more flexible in real-world spreadsheets.

NOT with Comparison Operators

NOT is often used with comparison operators to reverse their results. This example shows NOT combined with a greater-than comparison.

A B
15
10
=NOT(A1>A2)

This table demonstrates how NOT can be combined with comparison operators. The expression A1>A2 would normally return TRUE, but NOT reverses this to FALSE.

NOT with comparison
=NOT(A1>A2)

This formula checks if A1 (15) is greater than A2 (10), which is TRUE, then NOT reverses this to FALSE. This technique is useful for creating "is not" type conditions.

NOT with IF Function

NOT is frequently combined with the IF function to create reverse conditions. This example shows this powerful combination.

A B
FALSE
=IF(NOT(A1), "Approved", "Denied")

The table illustrates how NOT can be used within an IF function to reverse the logic of the condition. Since A1 is FALSE, NOT makes it TRUE for the IF test.

NOT with IF function
=IF(NOT(A1), "Approved", "Denied")

This formula checks the reversed value of A1 (FALSE becomes TRUE) and returns "Approved" because the condition is met. This pattern is common in decision-making formulas.

NOT with AND/OR Functions

NOT can be combined with AND or OR functions to create more complex logical tests. This example demonstrates NOT with AND.

A B C
TRUE FALSE
=NOT(AND(A1,B1))

This table shows how NOT can invert the result of an AND function. The AND of TRUE and FALSE is FALSE, which NOT then converts to TRUE.

NOT with AND function
=NOT(AND(A1,B1))

This formula checks if both A1 and B1 are TRUE (they're not), then NOT reverses the FALSE result to TRUE. This creates a "not both" condition, useful in many scenarios.

The same idea applies to OR. The formula below returns TRUE only when the color is neither green nor red, because NOT flips the OR result.

A B C
blue
=NOT(OR(A1="green", A1="red"))
NOT with OR function
=NOT(OR(A1="green", A1="red"))

Here the OR returns FALSE because A1 is "blue", and NOT reverses that to TRUE. Combining NOT with AND and OR is the standard way to express negative compound conditions.

NOT with IS Functions

NOT is especially useful with the IS family of functions, because those functions already return TRUE or FALSE. Wrapping them in NOT gives the opposite test.

A B
42
=NOT(ISBLANK(A1))

Because A1 contains a value, ISBLANK(A1) is FALSE, so NOT(ISBLANK(A1)) is TRUE. This is the standard way to test that a cell is not empty.

NOT with ISBLANK and ISERROR
=NOT(ISBLANK(A1))
=NOT(ISERROR(A1))
=IF(NOT(ISBLANK(A1)), B1/A1, "")

NOT(ISERROR(A1)) returns TRUE when A1 does not contain an error. The third formula only performs the division when A1 is not blank, which prevents a division-by-zero error when A1 is empty.

NOT with Numeric Values

NOT treats numeric values as logical values where 0 is FALSE and every other number is TRUE. This example demonstrates this behavior.

A B
0
1
=NOT(A1)
=NOT(A2)

The table shows how NOT interprets numeric values. A1 (0) is treated as FALSE, so NOT returns TRUE. A2 (1) is treated as TRUE, so NOT returns FALSE.

NOT with numeric values
=NOT(0)    ' TRUE, 0 is FALSE
=NOT(1)    ' FALSE, 1 is TRUE
=NOT(5)    ' FALSE, any non-zero number is TRUE
=NOT(-1)   ' FALSE, negative numbers are also TRUE

These formulas demonstrate NOT's handling of numbers. Zero returns TRUE, while 1, 5, and -1 all return FALSE because any non-zero number counts as TRUE. The sign of the number does not matter, only whether it is zero.

NOT with Text and Blank Cells

NOT expects a logical value, so text cannot be used directly. Passing text such as "Hello" produces a #VALUE! error. A truly blank cell, on the other hand, is treated as 0 and therefore as FALSE.

A B Result
(blank) =NOT(A1) TRUE
Hello =NOT(A2) #VALUE!
NOT with text and blank cells
=NOT(A1)       ' A1 is blank, treated as 0, returns TRUE
=NOT("Hello")  ' #VALUE!, text is not a logical value

To test text without causing an error, compare it first. For example, =NOT(A1="done") is valid because the comparison produces TRUE or FALSE, and NOT then reverses it. Never pass raw text straight to NOT.

NOT with Error Values

If the argument to NOT is an error value, NOT will return the same error. This example demonstrates this behavior.

A B
#N/A
=NOT(A1)

The table shows how NOT reacts when given an error value. The #N/A error in A1 causes the NOT function to also return #N/A, propagating the error.

NOT with error values
=NOT(A1)

This formula attempts to reverse the logical value of A1, but since A1 contains an error, the formula returns the same error. Error handling would be needed to prevent this.

NOT vs the <> Operator

The <> operator means "not equal to" and can often replace NOT when you are negating a single comparison. These two formulas return exactly the same result.

NOT and the not-equal operator
=NOT(A1=10)   ' TRUE when A1 is not 10
=A1<>10      ' TRUE when A1 is not 10

Both formulas return TRUE when A1 is anything other than 10. For a simple inequality the <> operator is shorter and easier to read. NOT is required when the condition is compound, because a multi-part test such as =NOT(AND(A1>0, B1>0)) has no direct <> equivalent.

Double Negative (--) with NOT

Logical values can be converted to numbers with the double unary operator (--), which forces TRUE to 1 and FALSE to 0. Because NOT already returns a logical value, prefixing it with -- turns its result into a countable number.

Converting NOT results to numbers
=--NOT(TRUE)                 ' 0, because NOT(TRUE) is FALSE
=--NOT(FALSE)                ' 1, because NOT(FALSE) is TRUE
=SUMPRODUCT(--NOT(ISERROR(A1:A5)))   ' counts cells without errors

The last formula counts how many cells in A1:A5 do not contain an error. Each NOT(ISERROR(...)) returns TRUE or FALSE, the double negative turns those into 1s and 0s, and SUMPRODUCT adds them up. This idiom is common when you need to count the results of a logical test.

NOT in Conditional Formatting

NOT can be used in conditional formatting rules to apply formatting when a condition is not met. This example shows a practical application.

Conditional formatting with NOT
=NOT(A1>100)

This formula would be used in a conditional formatting rule to format cells where the value is NOT greater than 100. When A1 contains 50, the condition would be TRUE and formatting applied. Use it as a formula-based rule, with the reference adjusted for the top-left cell of the selected "Applies to" range.

NOT Errors and Troubleshooting

Cause Symptom Fix
Text that is not a logical value #VALUE! error Pass a logical test such as A1>10, or the constants TRUE/FALSE, instead of raw text
Referenced cell contains an error The same error is passed through Test first with ISERROR, or wrap the formula in IFERROR
Blank cell assumed to be TRUE NOT returns TRUE unexpectedly A blank cell is 0 (FALSE); check with ISBLANK
More than one argument Too many arguments error NOT accepts exactly one argument
Using NOT where <> is meant Confusing or unnecessarily long formula Use =A1<>10 for a simple inequality

The NOT function is a versatile tool in Excel's logical function arsenal. From simple value reversal to complex conditional tests combined with IF, AND, OR, and the IS functions, NOT provides essential logical inversion capabilities. Remember the two rules that trip people up: numbers are coerced so that 0 is FALSE and every other value is TRUE, while text is not a logical value and returns #VALUE!. Mastering NOT will enhance your ability to create sophisticated logical tests and decision-making formulas in Excel.

Author

My name is Jan Bodnar, and I am a passionate programmer with extensive programming experience. I have been writing programming articles since 2007. To date, I have authored over 1,400 articles and 8 e-books. I possess more than ten years of experience in teaching programming.

List all Excel Formulas.