Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, 2021, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Determining a Value of a Cell.

Determining a Value of a Cell

Written by Allen Wyatt (last updated August 24, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, and Excel in Microsoft 365


5

You already know that a cell in a worksheet can contain any number of different items: numbers, dates, formulas, and so on. There may be times when you want to determine the underlying value in a cell, without regard to the way the cell is formatted. For this need, Excel provides the N worksheet function. For instance, let's assume that cell F17 contains a date. If you use = N(F17) as your formula, the value returned by the formula is the underlying serial number used for the date.

Besides returning date serial numbers, the N worksheet function returns a number if the referenced value or cell can be resolved to a number, a 1 if the value or cell can be resolved to the logical value True, and a 0 for anything else. The following provides a few examples of how the N worksheet function works:

Value in F17 Returned by = N(F17)
3/17/19 43541
37.14 37.14
TRUE 1
Quarter 1 0
5:40 0.236111

There is another rather unique (and very esoteric) use for the N function—you can use it to add comments to formulas. For instance, consider the following:

=SUM(A2:A267) + N("sales for northwest region")

Because N returns a value of 0 for the text (as indicated in the table above), adding 0 to the result of the SUM doesn't affect the return value at all. It may look a little strange in the Formula bar, but the result is that you are able to handily document what the formula does.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11552) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Determining a Value of a Cell.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Previewing Your Web Page

Need to see what your document would look like as a Web page? Word allows you to get a glimpse by using the Web Page ...

Discover More

Using the Organizer to Manage Toolbars

The Organizer is a great tool for managing different elements that can be stored in documents and templates. This tip ...

Discover More

Accessing Paragraphs in a Macro

Need to process a document, paragraph by paragraph, in a macro? It's easy to do once you understand that Word's object ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Using the COLUMN Function

Need to know the column number for use in a formula? The worksheet function you want is the COLUMN function, described in ...

Discover More

Using SUMIF with Text Parameters

The SUMIF function is supposed to work just fine doing comparisons with text values. This isn't a hard-and-fast rule, ...

Discover More

Specifying a Language for the TEXT Function

You may want to use Excel to display dates using a different language than your normal one. There are a couple of ways ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 - 7?

2024-08-28 02:16:25

Enno

Why should I use the N-function?
In all the shown cases the internal value is the same as the value, the N-function delivers. You can see this, if you format the cells to "standard".
You can even calculate with these values. So it is easier to add a zero for the true/false values and format the cells to "standard".

Enno


2024-08-26 12:03:22

J. Woolley

Another Excel function similar to N is T(arg). If arg is text, T returns arg; otherwise, T returns a null string ("").

To add a comment to a cell formula:
For a numeric or logical formula (represented by ...), use
    =N("comment") + ...
which adds zero as described in the Tip. In this case a logical formula will return 1 for TRUE and 0 for FALSE; if you want to return TRUE/FALSE, use
    =OR(N("comment"), ...)
With a text formula, use
    =T(N("comment")) & ...
which prepends a null string ("") because N("comment") returns zero.

To make a cell formula Volatile (update each time Excel recalculates):
For a numeric or logical formula (represented by ...), use
    =N(T(NOW())) + ...
which adds zero because T(NOW()) returns a null string (""). In this case a logical formula will return 1 for TRUE and 0 for FALSE; if you want to return TRUE/FALSE, use
    =OR(N(T(NOW())), ...)
With a text formula, use
    =T(NOW()) & ...
which prepends a null string ("").

My Excel Toolbox includes MyFavoriteExcelNotes.PDF with randomly collected, poorly organized, and occasionally updated information like this;
see https://drive.google.com/open?id=1OYSSMYKh5Dh6zb69gel2pUK6HxIXxKu7
And see https://sites.google.com/view/MyExcelToolbox/


2024-08-26 09:39:16

David Allen

So that's how you add notes to a cell! I always thought there must be a way.
Thank you, Allen, that's really going to help me a lot in documenting my spreadsheets.


2024-08-24 15:46:22

Erik

I've always wished there was a way to add notes inside formulas. After all, it's common in programming. Little did I know there is one! Thank you very much.


2024-08-24 10:08:48

Dave Bonin

Love the use of N() for commenting.

I've always thought Excel needed a way to do in-formula comments, kind of like you can with using a single quote in VBA.

Using cell comments (now called notes) seems too heavy-handed and interferes with the end-user experience.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.