profile

Google Sheets Tips

21% through the year! (Date Formulas)

Published about 1 month ago • 3 min read


Hi Reader,

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

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

SHEET CHAT

Your Powerful AI Google Sheets Copilot

Sheet Chat is an AI-powered Copilot that helps you work efficiently in Google Sheets and Google Docs. Use it for free with your OpenAI API key and hosting, and create your own custom agent based on your specific requirements.

DATA-INFORMED IMPACT

Data in Education, A Virtual Summit

Become part of a community of educators committed to using data to make a difference in the lives of students. Our virtual summit provides a space to connect, collaborate, share best practices, and troubleshoot challenges. Learn from others, discover resources, and leave feeling inspired and equipped to impact student success.

➜ News

I.
Into Apps Script? Don't miss the Totally Unscripted show this Wednesday, 20th March at 3pm EST.

This week's guest is Phil Bainbridge, from the University of York, who will share his insights on automating tasks with Apps Script.

Show link: Totally Unscripted: Level Up Your Productivity

_______

➜ Google Sheets Tip #295: Year-in-progress date formulas

On Twitter, I follow an account called Year Progress. It dubs itself as the "only progress bar you'd rather see go slower", which sounds about right.

This morning, it informs me we're already 21% through the year!

21%! Where does the time go?

Having recovered from this blow, I thought I'd better share it with you and see how we can create our version in Sheets.

Grab the nearest blank Google Sheet and follow along!

Today's Date Formula

Enter this formula in cell C2 to display today's date:

=TODAY()

To calculate how far through the year we are, we need to know the first and last days of the year too.

The simplest way is to type the dates "1/1/2024" and "12/31/2024" into cells of our Sheet.

However, these won't update automatically when the year changes. Let's make them dynamic formulas.

Dynamic Date Functions

The DATE function takes year, month, and day number inputs and outputs a valid date.

The YEAR function extracts the year number from a date.

So YEAR(TODAY()) will extract the year value (2024) from today's date.

Combine these, and we can get the first and last days of the year from today's date.

This formula, in cell C3, generates the first day of the year dynamically:

=DATE(YEAR(TODAY()),1,1)

And this, in cell C4, the last day of the year:

=DATE(YEAR(TODAY()),12,31)

These will roll over to 2025 automatically.

To calculate the number of days between dates in Sheets, we subtract them.

Thus, days gone is:

Today's date - First Day + 1 (to account for today)

In my case, I have today's date formula in cell C2 and the first-day formula in C3. So, in cell C6:

=C2-C3+1

and then the days remaining in the year are:

Last Day - Today's date

In cell C7:

=C4-C2

We're here:

So far, so good?

Year-In-Progress Chart

Although these numbers tell us how far we are through the year, they don't convey a sense of progress.

For that, let's call in the cavalry.

Enter the dazzling SPARKLINE function.

The SPARKLINE function is a magical function that turns numbers into mini-charts inside a single cell.

It takes two arguments: the data and chart options.

In our case, we'll specify a bar chart.

With the days gone and days to go data in cells C6 and C7 respectively, our formula is:

=SPARKLINE( C6:C7, { "charttype" , "bar" })

(Note the two "t"s in charttype)

The output of all this is our year-in-progress chart:

which looks like this in the wider context:

We have 79% of the year remaining.

Let's get after it team!

Advanced Extension

For those of you hungry for more...

I'm obsessed with the LET function and use it to simplify all my complex formulas.

In this example, we could capture all these intermediary steps as variables in the LET function.

We can create the chart with a single formula now:

Feel free to take it even further and customize the colors!

_______

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

Have a great week!

Cheers,
Ben

P.S. I feel your pain...

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