Brought to you by:
Welcome to the Google Sheets Tips newsletter #338, your Monday morning espresso, in spreadsheet form! After a last bite from winter last week, it looks like spring is finally here where I live on the east coast of the US. The daffodils are growing, the box turtles are out sunning themselves on logs by the river, and temperatures are forecast in the 70s (in the 20s celcius). Wherever you are, I hope you're enjoying the changing of the seasons. ➜ NewsI. ➜ MembershipLast week in Sheets Insiders, we had a fantastic turnout of almost 200 people for our live workshop: Unlocking the Secrets of LAMBDA Functions Normally the replays are for members-only, but since last week's workshop was open to everyone, you're welcome to watch the replay here: Today's tip — how to count winning streaks — was one of the examples we shared in last week's workshop. Check it out below our sponsor message. ➜ Sheets Tip #338: Win Streak FormulaThose of you who've read this newsletter for a while will know that I'm a fan of Liverpool Football Club. They play football (or soccer for my US friends) in the English Premier League and are currently enjoying a fantastic season, sitting top of the league. Go Reds! Their win/draw/loss record for the season so far is: WWWLWWWWDWWWWDDWWWDWWWWDWWW Looking good! Today, let's create a formula that counts the longest winning streak, i.e. the maximum number of consecutive "W". First, let's split that win streak out into separate cells, and transpose to a column view with this formula: =ArrayFormula(MID(A1, SEQUENCE(LEN(A1)), 1)) Our data looks like this: Next, we use a SCAN function — which is a LAMBDA helper function — to add a count for each "W". Enter this formula in cell B4: =SCAN(0,A4:A30,LAMBDA(a,c,IF(c="W",a+1,0))) How does this formula work? We give the SCAN function a start value (0) and then add 1 to it every time there is a "W" in that row. If there is not a "W", it resets to 0 and starts the "W" count over again. Finally, we use this simple MAX function to find the longest win streak: =MAX(B4:B30) which looks like this in our Sheet: And if you're a formula fiend, feel free to combine them all into a single formula: =ArrayFormula(MAX(SCAN(0,MID(A1, SEQUENCE(LEN(A1)), 1),LAMBDA(a,c,IF(c="W",a+1,0))))) For more LAMBDA resources, check out this resource. 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.
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #337, your Monday morning espresso, in spreadsheet form! I'm sharing a simple pivot table trick today that's one of those hidden gems in spreadsheets. Once you know it, you'll never go back. Suppose you create a complex pivot table and you want to create a second version so you can try a different filter perhaps. Well, today's trick lets you quickly duplicate the pivot table, rather than having to build again from the...
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #336, your Monday morning espresso, in spreadsheet form! This week, we're looking at use cases for the text rotation tool. I don't use it often but it's a nice technique for styling your Sheets. I've used it to add branding to my Sheets (see use case 2 below). Find tip #336 below our sponsor message and a few articles to share from the spreadsheet world. Brought to you by: BudgetSheet Save Time This Tax Season With...
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #335, your Monday morning espresso, in spreadsheet form! Today, I'm sharing some formulas that I use all the time: date formulas. I do a lot of project management planning in Sheets so I'm always needing to generate sequences of dates. Below, you'll find a roundup of the most useful. But first, I'm delighted to share today's sponsor with you. If you're serious about working with data then learning how to code with the...