Google Sheets Functions – NOW, TODAY, DAY, MONTH, YEAR

In this post we’re going to look at some of the basic date functions and in particular, how we can extract parts of a date or a time.  We’ll cover: NOW, TODAY, DAY, MONTH, YEAR, HOUR, MINUTE, and SECOND.


Example 1 – Getting the current date and time

We can add the current date and time to our sheet with the very simple function, NOW.

Type the following:

functions12-1

This will add the current date and time in the cell.

functions12-5

This doesn’t update every second, but by default will update every time there’s a change made on the sheet. We can alter this by changing the recalculation settings. Go to “File” then “Spreadsheet settings”.

functions12-2

Under “Recalculation”, click the drop-down menu that says “On change”.

functions12-4

Here you will have three options. Choose the one you want, then click “Save settings”.

functions12-3


Example 2 – Getting today’s date and using it in calculations

Similar to above, we can get today’s date by using the TODAY function. Type the following:

functions12-6

This adds today’s date in the cell.

functions12-7

We often use this function in calculations. For example, let’s find out how many days are left until Christmas day.

In cell B1 I have Christmas day and in cell C1 I type the following:

functions12-8

This just subtracts Christmas day from today’s date and returns the number of days, which at the time of writing, there are 41.

functions12-9

We can improve the returned result by adding some text to show what it is.

We start with the same formula as before, then add an ampersand and within inverted commas, we add the text we want.

functions12-10

As we can see, this adds the number of days to the text. This will count down every day.

functions12-11


Example 3 – Extracting the day from a date

Sometimes we want to extract a particular part of the date, to find out some piece of information. As an example, here we have the number of students that signed up for courses. The courses start either on 1st of the month, or on 15th. The Marketing department want to know which is more popular, the 1st or the 15th. From the data, it’s difficult to see.

functions12-12

So, first we need to highlight which days are the 1st and which are the 15th. We can do this, by adding the following DAY function to column C. In cell C2 type the following, then copy it down the rows.

functions12-13

This has extracted just the days from the dates in column A.

functions12-14

Now we can add up those which are the 1st and those which are on the 15th.

functions12-15

To do this we use a SUMIF function (see my post on this). Write the following in cell F1:

functions12-16

This looks in range C2:C13 and checks to see if there are any “1s”, if there are it adds up the number of students in column B, that correspond. Similarly, we do the same for “15ths”.

functions12-17

We can see above that the 15th has more students.


Example 4 – Extracting the month or year / Find out how old someone is

Similar to the DAY function, we can also use the MONTH and YEAR functions to extract the month and year from a date.

In cell A1, I have a birthday. In cell B1, I’ve added the MONTH function you can see in cell C1. This returns the month as a number from 1 to 12.

functions12-18

We can do the same with the year. In cell B2, I’ve added the YEAR function you can see in cell C2, and this returns the year.

functions12-19

Let’s find out how old this person is. In cell B3, I’ve written the formula you can see in cell C3. This gets the year from today’s date and then subtracts the year in cell A1, i.e. 2016-1973. It then returns the number of years.

functions12-20

Similar to example 2, we can add some text to the number to make it more meaningful, by using the ampersand.

functions12-21

The same applies for extracting times from a date and time. We have the HOUR, MINUTE and SECOND function which will extract the different parts of a time.

functions12-22

As you can see, by themselves these functions are limited but when combined with other functions, they allow you to work with dates and calculate what you want.


eBooks available on Drive, Forms, Sheets, Docs, Slides, and Sheet Functions:

Baz Roberts (Flipboard / Twitter / Google+)


One thought on “Google Sheets Functions – NOW, TODAY, DAY, MONTH, YEAR

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s