How to Use the YEAR Function in Google Sheets

Are you tired of dealing with excess information in your dates? Do you want to extract just the year from a given date in Google Sheets effortlessly? Look no further! In this article, we will guide you on how to use the powerful YEAR function in Google Sheets to extract the year from any date.

Understanding the YEAR Function

The syntax of the YEAR function is quite simple: =YEAR(date). Let’s break it down to help you understand the syntax and what each term means:

  • The equals sign is how we start any function in Google Sheets.
  • YEAR() is the actual function we are using.
  • “date” is the given unit of time from which we want to extract the year.

Here are some important points to note when writing your own YEAR function in Google Sheets:

  • Like other date functions we have mentioned before (DAY and MONTH), the YEAR function cannot read all human-readable dates. You will need to use a cell reference, a date function, or a date serial number returned by the N function.
  • The YEAR function will return an error (#VALUE!) if the given unit of time is recognized as text instead of a number.

A Concrete Example of Using the YEAR Function

Let’s see how the YEAR function works with different date values. This will help you understand the function and how to use it effectively in Google Sheets.

How to use the YEAR function in Google Sheets

Whether you enter the date with slashes (in cell A2) or hyphens (in cell A3), the YEAR function will recognize it as a number and return the corresponding year. The same goes if you add the time after your date (in cells A5 and A6). However, note that the YEAR function will not recognize your date as a number if you enter it with periods (in cell A4).

But be cautious when using words to enter your date (in cells A7, A8, and A9). As you can see in cell B8, the YEAR function will not work if you enter your date as “1st,” “2nd,” “3rd,” etc., and it will return an error (#VALUE!).

The dates in cells A10 and A11 are entered using the NOW and TODAY functions. Both dates are recognized as date values by the YEAR function, and it was able to extract the year from them. Please note that these two date values change, so the result will be different when you make a copy of this sheet.

Using the YEAR Function in Other Formulas in Google Sheets

If you remember our example from the beginning of this article, we not only need the birth year of each candidate but also need to know if they are over 18 years old or not. For that, we will use the IF function.

Enter the formula as follows: =IF(YEAR(TODAY()) - YEAR(B3) >= 18, "Adequate", "Inadequate") in cell D3.

Now, enter the formula in other cells, modifying the cell reference accordingly. Thanks to the YEAR and IF functions, you will discover which candidates are over 18 years old and which are not.

That’s it! Now you know how to use the YEAR function in Google Sheets! Learn more about using the IF function in Google Sheets or check out other Google Sheets formulas to discover how to create even more efficient formulas that will help you sort and filter your data. Join us at Crawlan.com for more information.

Related posts