ThisCalculator

Everyday

Ad Comments in Excel Formulas: Explained

Updated · Standard formula, shown below

Average pace 5.00 min/km
Average speed
12.00 km/h
Result
Finish time
50 min
You entered
Distance
10 km
You entered

Ad Comments in Excel Formulas: Explained

Ad comments within Excel formulas are text notes you can embed directly inside a formula using the N() function, allowing you to document your work without affecting the calculation. This article explains how to add them, why they’re useful, and how to avoid common pitfalls.

Formula

The formula for adding an ad comment is simply the N() function wrapped around a text string. In Excel, the N() function converts a value to a number, but when given text it returns 0. This means you can add a comment like +N("Your comment here") anywhere in a formula, and it will not change the result. For example:

=A1+B1+N("This adds two cells")

Here, A1 and B1 are cell references containing numbers, and the N() function returns 0, so the formula correctly computes the sum.

Worked Example

Using the defaults from the calculator above (finish time = 50 minutes, distance = 10 km), let’s calculate the average pace and speed.

  1. Average pace = finish time / distance = 50 min / 10 km = 5.00 min/km
  2. Average speed = distance / (finish time in hours) = 10 km / (50/60) h = 12.00 km/h

In Excel, you could write =t/d+N("Pace in min/km") and get 5.00, and =d/(t/60)+N("Speed in km/h") to get 12.00.

Why Use Ad Comments?

Ad comments serve as inline documentation. They are especially useful when you inherit a spreadsheet from someone else or revisit your own work after a long time. Instead of scrolling to a separate notes column, you can see the explanation right where the calculation happens. This is particularly helpful for complex formulas with multiple steps, where a comment can clarify what each part does.

How to Add Them

Adding an ad comment is straightforward:

  • Place the cursor inside the formula bar where you want the comment.
  • Type +N(" and then your comment text, followed by ").
  • Press Enter to apply the formula.

For example, to comment on a VLOOKUP, you might write:

=VLOOKUP(A1, B:C, 2, FALSE)+N("Looks up ID in column B and returns value from column C")

Common Mistakes and Limitations

One common mistake is forgetting the plus sign before N(). Without it, the N() function becomes the first argument, and Excel may interpret the formula incorrectly. Another issue is that N() only works with text; if you try to use it with a number, it will convert that number to a number (which is fine), but if you use a cell reference that contains text, it will return 0, which might not be what you want.

Also, ad comments do not appear in the formula bar as a tooltip; they are just part of the formula. If you want a more visible note, consider using Excel’s built-in cell comments (right-click > Insert Comment) or a separate documentation sheet.

Alternatives to Ad Comments

If you need more robust documentation, consider these alternatives:

  • Cell comments: Right-click a cell and choose “Insert Comment” to add a note that appears when you hover.
  • Named ranges: Give meaningful names to cells or ranges (e.g., TaxRate instead of B2) to make formulas self-explanatory.
  • Separate documentation sheet: Create a “Notes” sheet that explains each formula in detail.

Frequently Asked Questions

Can I use ad comments in Google Sheets?

No, the N() function in Google Sheets does not accept text and will return a #VALUE! error. In Google Sheets, you can use the IF function with a comment, but it’s not as clean. Better to use cell notes or a separate documentation tab.

Do ad comments slow down my spreadsheet?

No, the N() function is extremely lightweight. It adds negligible computation time, even in large spreadsheets.

Can I reference a cell in an ad comment?

No, the N() function only accepts a literal text string, not a cell reference. If you need to show a dynamic note, use a cell comment or a formula that concatenates text with cell values.

Why does my formula show 0 when I use N()?

That’s expected because N() returns 0 for any text. The comment is just for documentation; it doesn’t affect the result. If you see 0 as the final result, it means your formula is only the comment and nothing else.

Can I use ad comments in array formulas?

Yes, you can add N() comments inside array formulas. Just ensure the comment is placed correctly, and the array formula will still compute normally.

Are ad comments visible when printing?

No, ad comments are part of the formula, not the cell display. They are only visible in the formula bar when you select the cell.

Related

Formula used
in t | Finish time | min | 50 | 0
in d | Distance | km | 10 | 0
out pace | Average pace | min/km | t / d | 2
out speed | Average speed | km/h | d / (t / 60) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.