Basically, in Excel, the NOT function reverses the results of logical value. In situations where we need to know whether or not a given condition was met, the NOT function comes in handy.
In this article, I’ll discuss the ins and outs of the function, starting from the basics to VBA code, including eight practical examples.
NOT Function in Excel (Quick View)
Download Excel Workbook
Excel NOT Function: Syntax & Arguments
Firstly, we’ll see the syntax and argument of the function. If you insert the function after entering equal sign (=), you’ll see the following figure.
NOT is a logical function. This function helps to verify that one value is not the same as another. If you give TRUE, FALSE is returned and FALSE is given, TRUE will be returned.
In essence, it always returns a logical opposite value.
Reversed Value (logical)
|Argument||Required or Optional||Value|
|logical||Required||A logical value that can be evaluated either TRUE or FALSE|
How to Use the NOT Function in Excel (With 8 Examples)
Example 1: Basic Example of NOT Function
The NOT function reverses the logical values TRUE and FALSE. In the following figure, there are basic examples of using the function. Such as the input in cell B5 is TRUE, the NOT function returns the opposite FALSE in cell C5. Usually, 0 is considered as FALSE in Excel, so the NOT function returns TRUE with 0. In the case of any other number, the output will be FALSE.
Example 2: Using the NOT Function to Omit A Certain Value
If you wish, you can use the NOT function to exclude a specific cell value. For example, you can find any product but TV. If the input product is TV, the result will be FALSE. Otherwise, the result will be TRUE. The formula will be:
Example 3: NOT for Greater Than or Less Than Value
If you want to find which cell value is not greater than a specific value. Such as, you can find the prices of the products which are not greater than $200. If the condition is fulfilled, the result will be shown as TRUE.
The formula will be-
Example 4: NOT with OR Function
You can use the OR function with the NOT function.
Let’s imagine, a list of products is provided in front of you. But you want to get any product except TV and AC. In such a case, just use the following formula.
Example 5: NOT with AND Function
Assuming another condition, you want to exclude the TV made by Silo Digital. For this, you have to use the AND and NOT functions. The formula will be:
Example 6: NOT with IF Function
IF is a popular Excel function that is mainly for meeting logical statements.
For example, you don’t want to buy the product TV or AC. Now, you have to use the following formula. If the criteria are found, the result will be shown as “Don’t buy” (represents TRUE). The formula will be:
=IF(NOT(OR((B5="TV"),(B5="AC"))),"To buy","Don't buy")
Example 7: NOT with ISBLANK Function (Working with Blank Cell)
If you guys need to consider the blank cell, you may use the ISBLANK cell. Also, you can add the NOT function.
For example, the price is increased for some products shown as “extra price” in the following figure. If the sales are declined in the case of those products, then the seller may offer a discount e.g. 10% for those products on the extra price. Here, products without extra price won’t be considered.
In such a situation, you may utilize the following formula.
=IF(NOT(ISBLANK(E5)), E5*10%, "No discount")
Example 8: NOT Function Using VBA in Excel
If you have a larger dataset, it is time-consuming and a little bit boring to get the required result using a formula.
Rather you can utilize the VBA code in Excel which performs the result rapidly and accurately.
Now, let’s see how you can apply the VBA code to calculate the number of minutes.
Firstly, open a module by clicking Developer>Visual Basic>Insert>Module.
Then, copy the following code in your module.
Sub Excel_NOT_Function() 'declare a variable Dim ws As Worksheet Set ws = Worksheets("NOT VBA") 'apply the Excel NOT function ws.Range("C5").Formula = "=NOT(ISNUMBER(B5))" ws.Range("C6").Formula = "=NOT(ISNUMBER(B6))" ws.Range("C7").Formula = "=NOT(ISNUMBER(B7))" ws.Range("C8").Formula = "=NOT(ISNUMBER(B8))" ws.Range("C9").Formula = "=NOT(ISNUMBER(B9))" End Sub
The following things are essential in the above VBA code.
- Worksheet name: Here, the worksheet name is “NOT VBA”
- Logic: The ISNUMBER function finds whether a cell value is a numerical value or not.
- Input cell: Here, the input cell is B5, B6, etc.
- Output range: The output range is C5, C6, etc.
Common Errors While Using the NOT Function
|Common Errors||When they show|
|#VALUE!||– Occurs when the cell range is inserted as input.|
This is how you can apply the NOT function to reverse the logical value TRUE and FALSE. Also, you have the opportunity to combine the function with other Excel functions. If you have an interesting and unique method of using the NOT function, please share it in the comments section below.
Thanks for being with me.