N


Returns the numeric value.

Syntax:

N(value)

returns the numeric value of value if possible. It returns the logical values TRUE and FALSE as 1 and 0 respectively.

N() is not intended to convert text to a number - use the VALUE() function instead.

Example:

N(123)

returns 123, because 123 is (already) a number.

N(TRUE)

returns 1.

N(A3)

where A3 contains FALSE, returns 0.


Application:

Using the N function in a Spreadsheet


Imagine you are managing a product inventory spreadsheet for a small business. You have a column for "Product Status," which contains text values, and you need to perform a calculation on these statuses to determine a "Stock Adjustment Value." You decide that 'Discontinued' products should have a value of -10, 'On Backorder' should be 0, and any other status should be 1. The N function can help you with this by converting the text status into a number that you can then use in a formula.


Scenario: You need to calculate the "Stock Adjustment Value" for each product based on its status.


Table:

Product ID

Product Status

N Function's Intermediate Result

Stock Adjustment Value (Calculated)

A
B
C
D
1
P-101
In Stock
0
1
2
P-102
Discontinued
0
-10
3
P-103
On Backorder
0
0
4
P-104
In Stock
0
1
5
P-105
Re-stocked
0
1
6
P-106
50
50
1

Explanation:

  • Column B (Product Status): Contains text values describing the status of each product.
  • Column C (N Function's Intermediate Result): This column demonstrates how the N function works.
    • N will return 0 for any text value.
    • N will return the number itself if the cell already contains a number.
    • Note: The N function itself is limited. It's more useful for converting Booleans to numbers (TRUE becomes 1, FALSE becomes 0) or for a specific type of formula where you want to ensure a cell's content is treated as a number.
  • Column D (Stock Adjustment Value): This is the ultimate goal of the example. We can't directly use the N function to get our desired values (-10, 0, 1) from the text. The N function is not an IF statement.
  • The Correct Approach: As the table shows, the correct and most common way to get a numeric value from a text string is to use an IF statement or a lookup function. The N function is not the ideal tool for this specific task.




This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof