|
Welcome to the Google Sheets Tips newsletter #292, your Monday morning espresso, in spreadsheet form! Quick question before this week's email: If you use Apps Script, what do you use it for? Follow up, what pain points do you have? (Feel free to just hit reply to this email.) A big thank you to this week's sponsors who help keep this newsletter free to read: ➜ New videos on YouTube🎥 Count Specific Days Between Two Dates in Google Sheets (inspired by last week's newsletter on counting Mondays) _______ ➜ Google Sheets Tip #292: Finding minimum and maximum names from valuesSuppose we have this dataset: We want to identify the customers with the minimum and maximum revenues. There are many ways to do this, including pivot tables, sorting the data, formulas, etc. Today, we'll use the powerful FILTER function to find the min/max customers. First, find the minimum revenue value with this MIN formula: =MIN(B2:B11)With the data shown above, this gives us the result of $1,260. Now, we want to find the customers associated with this value. To do that, let's use the FILTER function. The filter formula returns values that satisfy specific conditions. It takes two arguments, firstly a range to filter and secondly, the conditions to apply. We want to find the customer names for the minimum values, i.e. we want to filter the names. So the first argument in the FILTER is the customer names range in A2:A11. The second argument of our FILTER — the conditions to test — is a test to find when the revenue values (B2:B11) are equal to the minimum value. We already found the minimum with the MIN formula above. Hence, our complete formula is: =FILTER(A2:A11,B2:B11=MIN(B2:B11))In our Sheet: I like the FILTER function because it returns more than one result if there are multiple customers with the minimum value. Find the Top Customer(s) with MAXTo calculate the top customer, swap the MIN function for a MAX function in the formula. Neater with Named RangesDo you use named ranges? They're a method for attaching names to cell ranges in your Sheets. Then, instead of referring to a range as B2:B11 in your formulas, you can use the name, e.g. revenue. To create a named range, highlight our data (e.g. B2:B11) and go to the menu: Data > Named ranges Enter a name in the name box and click Done. Now we can use this named range inside our formulas and it points to the correct range. For example, the MIN formula above becomes: =MIN(revenue)Which, in our Sheet, looks like this: If we name the range A2:A11 as customers, then our complete FILTER formula becomes even cleaner: =FILTER(customers,revenue=MIN(revenue))In our Sheet: _______ If you enjoyed this newsletter, please forward it to a friend who might enjoy it. Have a great week! Cheers, P.S. Anyone else do this? |
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 #369, your Monday morning espresso, in spreadsheet form! We had our first snowfall of the season last Friday, so winter is definitely underway here in the Mid-Atlantic region. It was only a light dusting though, so the sleds are still hanging in the garage. For now. In this issue, we're looking at a clever way to add visual clues to our data tables with indicator arrows ▲🔻. And, if you're a Workspace customer, you must...
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #368, your Monday morning espresso, in spreadsheet form! I finished reading a fascinating book last week, Home on the Canal, a long-out-of-print history of the Chesapeake and Ohio Canal and the stories of the people who lived and worked along it. Today, I live beside the canal, now a beautiful National Historic Park, and cycle or walk on the restored towpath most weeks. Riding across the Antietam Aqueduct recently, I...
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #367, your Monday morning espresso, in spreadsheet form! For my birthday this year, my wife bought me a half-day fly fishing lesson. I had previously tried casting with a fly rod a few years ago in Wyoming, and have been keen to have another go ever since. As a middle-aged dad, my life is, well... maybe a little... predictable. In a good way. Family, work, exercise outdoors, eat, sleep, and repeat. It's a wonderful,...