Brought to you by:
Welcome to the Google Sheets Tips newsletter #358, your Monday morning espresso, in spreadsheet form! Today's tip comes from an accidental discovery I made whilst researching a trick with the LEFT and RIGHT functions. Let me ask you... What do you think happens with this formula? (Answer before trying it in your Sheet ;) ) = "A" < "B"
Check out the answer in today's tip and see a real-world application below. ➜ NewsI. ➜ Sheets Tip #358: Alphabet Comparison TrickSo it turns out you can use comparison operators (less than "<" and more than ">") with text strings! For example, ="A"<="B" outputs TRUE because the A is before B in the alphabet. (One way to understand this is to convert the letters to their decimal unicode characters and determine which is bigger or smaller. The unicode character for "A" is 65 in decimal terms. "B" is 66, etc.) More examples: So this is quite interesting! Let's see a real-world application. Practical Use CaseSuppose we work in a library and want to order our books into groups based on the first letter of the author's surname. We can use this formula to do that! =IF(LEFT(A2)<="M","A–M","N–Z") Firstly, the LEFT function is used to get the first letter of the surname. Quick tip: LEFT(A2) is shorthand for LEFT(A2,1) This letter is compared to "M" and the surnames are then assigned a group by an IF function. In our Sheet: A neat little formula! What if you want more groups? Use an IFS function (here combined with LET for readability) to achieve that: =LET( l , LEFT(A2), IFS( l<="G" , "A-G", l<="M" , "H-M" , l<="S" , "N-S" , l<="Z" , "T-Z" )) In our Sheet: Very satisfying! I do love a good formula 😍 If you enjoyed this newsletter, please forward it to a friend who might enjoy it. Have a great week! Cheers, P.S. Phew and nope |
Get better at working with Google Sheets! Join 50,000 readers to get an actionable tip in your inbox every Monday.
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #357, your Monday morning espresso, in spreadsheet form! Coming to your inbox on a Tuesday because it was a public holiday here in the US yesterday (Happy Labor Day!). I had a friend and his family visit (Mr Data School himself!). We had a great weekend exploring in the woods, watching the kids catch crayfish, and making s'mores over a fire in the evening. I feel recharged (and a little tired) and ready to dive into...
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #356, your Monday morning espresso, in spreadsheet form! I’m delighted to have my friend Justin Keene of EdTech-Training sponsoring this week’s newsletter. His company teaches educators how to use the Canvas LMS through self-paced learning courses, but here’s the cool part: he built the entire training platform itself with Google Apps Script! By combining libraries, web apps, and APIs, Justin powers real-time progress...
Brought to you by: Hi Reader, After a few weeks break for the summer 🏖️, we're back with the Google Sheets Tips newsletter #355, your Monday morning espresso, in spreadsheet form! What's new? AI continues to dominate the tech headlines, with new features crammed into every corner of the internet, whether they’re needed or not. But beyond the hype, the tools are improving, and that includes in the spreadsheet domain. These days, when I need to create a complex formula, I often start with a...