Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. 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

by Allen Wyatt
(last updated November 28, 2016)

4

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/11/99 36230
37.14 37.14
TRUE 1
Quarter 1 0
5:40 0.236111

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11552) applies to Microsoft Excel 2007, 2010, and 2013. 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

Getting Word to Remember the Default Date and Time Format

One way to insert the current date into your document is to use the Date and Time dialog box. The Default button in the ...

Discover More

Deleting Worksheet Code in a Macro

When creating an application in VBA for others to use, you might want a way for your VBA code to modify or delete other ...

Discover More

Dates with Periods

You may want Excel to format your dates using a pattern it doesn't normally use—such as using periods instead of ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Converting Radians to Degrees

When applying trigonometry to the values in a worksheet, you may need to convert radians to degrees. This is done by using ...

Discover More

Calculating Combinations

The COMBIN function is used to determine the number of combinations that can be made from a group of elements. This tip ...

Discover More

Indirect References to a DSUM Parameter

Indirect references can be very helpful in formulas, but getting your head around how they work can sometimes be confusing. ...

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. 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 0 + 7?

2016-11-29 10:27:48

Christian

@Stephen: first tip is great! I will use it now to comment my formulas.


2016-11-28 16:54:25

Stephen Barrett

Hi Allen

Greetings from New Zealand, I trust you are well.

There's a couple of other uses for the N function, which I discovered by accident:

1. It can be added at the end of any formula to store a useful comment.
eg =SUM(A1:A365)+N("all 2016 sales")

Because N("any text string") has a value of 0, it doesn't alter the SUM, but allows the comment to remain with the formula. I find this easier than the more intrusive Comment feature, and is an alternative to Named Ranges/Formulae.

2. As a security feature, of sorts.
eg =NetProfit/N(A1), where NetProfit is a named range, and cell A1 contains nothing, or some innocuous text, but allows the above formula to display the value of NetProfit when the value 1 is entered, almost like a password.

Before this, the formula will yield #DIV/0! and will appear to be an error, whereas it is a deliberate result until 'the password' is entered.

One variation of this is using a multiplier or divisor in the cell that N refers to, to deliberately disguise or alter results.

This is made even more obtuse by changing the text colour of the 'password cell' to white, so the password - the argument of N - can be hidden in plain view.

These approaches will baffle many people because many people are unaware of the existence of N. Of course, someone whose middle name is Sherlock will trace this quite quickly, but it's not for them ;)

Shalom


2016-11-28 11:04:08

John

3/11/99, 37.14, TRUE and 5:40 could all be strings that only appear to be numbers, in which case the N function would return 0. Similarly, Quarter 1 could be a number formatted to appear as a string.


2016-11-28 07:29:31

Ken Varley

When using date examples, you should use a date that is not ambiguous.

In this tip, you give an example date of 3/11/99

Anyone in America reading this date will see it as 11th March

Anyone in England reading the date will read it as 3rd November

I appreciate that in this example it doesn't really matter, but if you used a date that was higher than 12th of the month (eg 15th), it would simplify the example by removing ambiguity


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.