|
Welcome to the Google Sheets Tips newsletter #299, your Monday morning espresso, in spreadsheet form! A big thank you to this week's sponsors who help keep this newsletter free to read: ➜ NewsI. At the Google Cloud conference they announced the new Tables feature coming to Sheets. I'm excited to get this functionality in Sheets, with pre-built formatting options and table referencing. Take a peek at what the new Tables will look like >> It sounds like it's only a few weeks away... _______ ➜ Google Sheets Tip #299: How To Add Comments In FormulasLast week (#tip 298) we looked at the LET function and I mentioned that it could be used to add comments to formulas. Today, let's see how to do that, along with three other methods. A comment is a short sentence that explains something in the formula, e.g. "this QUERY sorts the data alphabetically". It's a good idea to explain complex formulas. It'll be a huge help to our future self or our colleagues. It makes it easier to share our work and extend it in the future. Programmers use comments to explain their code. We're doing the same thing with our formulas. Simple formulas — such as SUM(A1:A10) — do not benefit from comments. (In fact, adding a comment makes the formula more confusing.) But with complex formulas, comments are helpful. An extreme example is the Chess formula I created earlier this year, where I used comments to label each move. 1. Note in Adjacent CellThe easiest way to add comments to our formulas is to simply add a note in the adjacent cell (shown in italic): The drawback to this method is that it requires an extra cell (which might interfere with other data or calculations), which is not linked to the formula. If someone inserts a column or moves data around, then it's possible the comment becomes detached from the formula. 2. Comment or Note on cellRight-click on the cell containing a formula and select "Comment" or "Insert note" from the menu: Both add a text box popup attached to that cell. Comments have much richer functionality (e.g. tagging other people, marking as read) but for formula comments, I favor the simplicity of the note. Cells with notes have a tiny black triangle in their top right corner (red arrow in the following image). The note shows when we hover over the cell: 3. Add comments with the LET functionAdd a comment with the LET function by including a named variable to hold the comment. Here's an extremely simple example: =LET(about,"Adds two numbers", A1+B1) The "about" variable is not used in the calculation formula. For more complex formulas, you can add extra comments: =LET(about,"Adds two numbers", The comment is now part of the formula, so it can't become separated from the formula. Also, it's hidden until you look at the formula so it doesn't clutter your Sheet. (Press Ctrl + Enter inside the formula editor bar to add line breaks to your formulas.) 4. Add comments with the N functionThe N function returns the argument provided as a number. However, if we apply N to a text value, it returns 0. Thus: =N("Adds two numbers") evaluates to 0. So we can add this to a number without changing the value of that number (1 + 0 is still 1). This allows us to add comments to any numeric values in the formulas. Here's how we could apply it to our simple example: =A1+B1+N("Adds two numbers") In our Sheet: Here's another simple example. And here's a complex example of using the N-comment method. Personally, since the introduction of the LET function, I favor this method to add comments to complex formulas. It's more flexible than the N-method. As always, let me know your thoughts or if you have any other ways you like to document your formulas. _______ If you enjoyed this newsletter, please forward it to a friend who might enjoy it. Have a great week! Cheers, |
Get better at working with Google Sheets! Join 50,000 readers to get an actionable tip in your inbox every Monday.
Hi Reader, Welcome to the Google Sheets Tips newsletter #391, your Monday morning espresso, in spreadsheet form! (Sorry there was no newsletter last week. I was sick!) This week we're looking at a cool use case for Google Sheets that most folks have no idea about. Creating QR codes! With a few simple formulas you can create QR codes in your Sheets that you could use to track inventory, accept invitations, or even print out to use at an event. First, a housekeeping announcement: after today,...
Hi Reader, Welcome to the Google Sheets Tips newsletter #390, your Monday Tuesday* morning espresso, in spreadsheet form! * public holiday in the US yesterday. Speaking of coffee, I usually work from my local coffee shop twice a week. It makes for a nice change of scenery from home. And everytime I order the same thing: a regular cappuccino, no frills, no syrups, no fancy milks. I think it says a lot about my personality and stage in life. As a working parent, neck deep in the world of AI,...
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #389, your Monday morning espresso, in spreadsheet form! After a major work sprint to launch the 28 Days to Gemini Mastery course earlier this spring, I recently took a few weeks off to visit my brother and his family in Australia. We spent time hiking and packrafting in Tasmania's remote and beautiful Southwest National Park. It was an incredible trip and, without cell service for 12 days, a true break from the noise...