+ Reply to Thread
Results 1 to 4 of 4

Adding comments/notation to a formula?

Hybrid View

  1. #1
    Registered User
    Join Date
    12-22-2022
    Location
    Colorado
    MS-Off Ver
    Microsoft 365
    Posts
    1

    Question Adding comments/notation to a formula?

    I've googled around and the only thing that seems to populate is the "N() formula", which shows the comments, and that's not what I want. I'm just trying to add notation to my formula, so if I need to reference it in the future, I don't forget what pieces of the formula does what lol.

    Is there a way to add text notation in a formula that doesn't affect the actual formula? Sort of like, CSS notation where you type /* comment here */?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,454

    Re: Adding comments/notation to a formula?

    Maybe something like this.
    Formula: copy to clipboard
    =LET(n_r, "Range to be used", r, B:B, n_fr, "filter range for non blank entries", fr, FILTER(r, r<>"", "no data"), fr)
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Valued Forum Contributor
    Join Date
    07-13-2021
    Location
    California, USA
    MS-Off Ver
    2010
    Posts
    513

    Re: Adding comments/notation to a formula?

    AFAIK, the answer is no. That is why people use the N() function.

    N("this is a comment") returns zero. So we can add it to any numeric expression, and it "doesn't affect the actual formula".

    Likewise, T(N("this is a comment")) returns the null string. So we append it to any string expression, and it "doesn't affect the actual formula".

    Some care might need to be exercised, especially if you add comments that way in the middle of expressions instead of just at the end of a formula.

    The performance impact should be negligible.

    Of course, alternatively, you can add a comment to the cell. But that might not help when you want to document "pieces of the formula".

  4. #4
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,046

    Re: Adding comments/notation to a formula?

    Following from post#2, you can with, additional spacing, make quite good pseudo comments using LET

    =LET(REM,"/*This formula adds two numbers together*/",
    
         A1+B1
    )

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 07-31-2014, 10:16 AM
  2. [SOLVED] Adding comments
    By The Skipper in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-03-2012, 04:25 PM
  3. Adding comments
    By jenniferpilates in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-03-2011, 01:12 PM
  4. Adding comments & deleting comments VBA
    By tian0020 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2007, 08:35 PM
  5. [SOLVED] Adding comments
    By Karla in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-03-2005, 05:05 PM
  6. [SOLVED] Adding Comments
    By Kim in forum Excel General
    Replies: 4
    Last Post: 03-17-2005, 10:06 AM
  7. [SOLVED] autofilter and adding comments
    By Valeria in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-24-2005, 01:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1