profile

Google Sheets Tips

Which function will you choose today?

Published about 2 months ago • 2 min read


Hi Reader,

Welcome to the Google Sheets Tips newsletter #294, your Monday morning espresso, in spreadsheet form!

A big thank you to this week's sponsors who help keep this newsletter free to read:

SAPIENGRAPH

Add LinkedIn and Crunchbase data via custom formulas to GSheets

Sapiengraph makes it easy to fill your Google Sheets with fresh, accurate data from LinkedIn and Crunchbase.

Using our intuitive custom formulas:

  • VCs can track the employee count of portfolio companies with “=SG_EMPLOYEE_COUNT()”
  • Salespeople can find prospects’ contact numbers with “=SG_PERSONAL_NUMBERS()”
  • Recruiters can obtain prospective hires’ work history with “=SG_PERSON_WORK()”

BASEROW

Get your sheet together once and for all

Break free from sheet limitations! Get everything you love about spreadsheets, without the downsides.

No row limits. No storage limits. No lock-in. No mess. No stress.

Only Baserow allows you to create it, scale it, and own it.

➜ New videos on YouTube

I was a guest on last week's episode of Totally Unscripted with Alice Keeler, Martin Hawksey, Charles Maxson (from Google), and Kara Ireland (from Google).

We chatted about Google Sheets and spreadsheets' persistence, and I demoed the powerful LET and NAMED functions.

Check it out here

_______

➜ News

I.
Last week Google introduced preset dropdown chips in Google Sheets, for common use cases like priority or review status.

Read more about preset dropdown chips here

_______

➜ Google Sheets Tip #294:

In this tip, we look at a hidden use for the SUBTOTAL function.

Typically, it's used to... well, err, create subtotals of data, without double-counting.

(See this post for a detailed explanation.)

But today I want to show you another use case for the SUBTOTAL function.

It can do more than sum your data. It has 10 other data aggregation choices, including count, min, max, and several statistical operations.

Combine it with a drop-down menu and you can let your users choose which aggregation function to apply!

Let's see how:

Build a Function Chooser Tool

Suppose we have this dataset:

We might want to run different aggregations to understand the data, e.g. SUM, AVERAGE, COUNT, etc.

Rather than insert every one of these functions into our Sheet separately, we can use a single SUBTOTAL instead.

The SUBTOTAL function lets us specify what aggregation method to use.

For example, this formula will sum the values in our dataset above:

=SUBTOTAL(9,B2:B11)

whereas this one will calculate the average value for us:

=SUBTOTAL(1,B2:B11)

Notice that the only thing that changes is the function code in the first argument (changes from 9 to 1).

The full set of function codes is:

So, we can create a Dropdown menu (here's how) from these function options:

Then, we let users select a function from this dropdown and an XLOOKUP returns the corresponding function number from the table.

We then nest this inside the SUBTOTAL:

=SUBTOTAL( XLOOKUP( D5, G2:G12, H2:H12), B2:B)

Now the aggregation option is driven by user choice!

_______

If you enjoyed this newsletter, please forward it to a friend who might enjoy it.

Have a great week!

Cheers,
Ben

P.S. Try not to laugh when you watch this

Google Sheets Tips

by Ben Collins

Get better at working with Google Sheets! Join 50,000 readers to get an actionable tip in your inbox every Monday.

Read more from Google Sheets Tips

Hi Reader, Welcome to this anniversary edition of the Google Sheets Tips newsletter, your Monday morning espresso, in spreadsheet form. This is the 300th edition of this weekly newsletter! 🎉 I've been sending it out for six years. The first issue — about keyboard shortcuts — was sent on 30 April 2018 to 2,357 of you. (Huge shout-out to anyone who's still with me!) In honor of this milestone, I want to look back at the six-year journey: The newsletter began life as the "Monday Tip" newsletter,...

6 days ago • 2 min read

Hi Reader, 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: SHORTFORM Raising the Bar on Book Summaries With Shortform, you get deep insights that go beyond the typical 1-pager, with chapter breakdowns, well-researched commentary and analysis, connections to other books and counter-arguments, and even interactive exercises. Instead of spending days on a...

13 days ago • 3 min read

Hi Reader, Welcome to the Google Sheets Tips newsletter #298, your Monday morning espresso, in spreadsheet form! I hope you are doing well on this fabulous Monday morning. As an adult, it's rare to experience something completely new in day-to-day life. Days follow a familiar pattern, even if the specifics are different. Last week, however, the New York region was hit by a rare earthquake (thankfully, not too serious). I happened to be in Legoland New York with my family, in the gift shop,...

20 days ago • 3 min read
Share this post