The YEAR function in Google Sheets returns the four-digit year from a given date. Its syntax is YEAR(date), where date is a reference to a cell containing a date, a date entered in quotes like "2024-03-15", or a formula that outputs a date. For example, =YEAR(A1) with the date March 15, 2024 in A1 returns 2024.
How the YEAR Function Works
Google Sheets stores dates internally as serial numbers, where each whole number represents a day counting from December 30, 1899. The YEAR function reads that serial number and extracts the calendar year. It does not care about the time portion of a datetime value; if a cell contains 2024-03-15 14:30, YEAR still returns 2024.
The function accepts any value that Google Sheets recognizes as a date. If you pass text that is not a valid date, such as "March 32", YEAR returns a #VALUE! error. If you pass a number that is not a date serial, like 100, YEAR interprets it as the date 100 days after December 30, 1899, which is April 9, 1900, and returns 1900.
Basic Usage Examples
Here are common ways to use YEAR in a spreadsheet:
- From a cell reference:
=YEAR(B2)where B2 contains2023-07-01returns2023. - From a date string:
=YEAR("2022-12-31")returns2022. - From another function:
=YEAR(TODAY())returns the current year, updating each time the sheet recalculates. - From a date created with DATE:
=YEAR(DATE(2025, 1, 15))returns2025.
Note that the date must be in a format Google Sheets understands. Using "2024/03/15" works, but "15/03/2024" may be interpreted as text depending on your spreadsheet locale, causing an error.
Combining YEAR with Other Functions
YEAR is most useful when combined with logical or aggregation functions. For instance, to count how many entries fall in a specific year, you can use SUMPRODUCT:
With dates in A2:A10 and the target year in C1, the formula =SUMPRODUCT(--(YEAR(A2:A10)=C1)) returns the count of dates in that year. The double unary (--) converts the TRUE/FALSE array to 1s and 0s.
To sum values by year, use SUMIFS with an array of years, but that requires a helper column. Alternatively, use QUERY: =QUERY(A2:B10, "select year(A), sum(B) where A is not null group by year(A)") groups sales by year.
Common Errors and Troubleshooting
The most frequent error is #VALUE!, which occurs when the argument is not a valid date. This often happens when:
- The cell contains text like
"March 15, 2024"with a comma, which Google Sheets may not parse as a date in some locales. - The date is stored as a string from an import. Use
DATEVALUEfirst:=YEAR(DATEVALUE(A1)). - The cell is empty. YEAR(empty) returns
1899because an empty cell is treated as zero, which is the serial for December 30, 1899. To avoid this, use=IF(A1="","",YEAR(A1)).
Another issue is that YEAR returns the year of the date, not the year of the week. If you need fiscal years that start in April, you must adjust manually: =YEAR(A1) - (MONTH(A1) < 4) returns the fiscal year starting in April (e.g., March 2024 becomes 2023).
YEAR vs. Other Date Functions
YEAR is one of three extraction functions, alongside MONTH and DAY. They all take a date and return the respective component. The key difference is that YEAR always returns a four-digit number, while MONTH returns 1–12 and DAY returns 1–31.
For more complex date math, you might use DATEDIF to calculate the number of years between two dates: =DATEDIF(A1, B1, "Y") returns complete years. Unlike YEAR, DATEDIF works with two dates and gives a difference, not an extraction.
There is also ISOWEEKNUM and WEEKNUM for week numbers, which can be combined with YEAR to get ISO year-week combinations, but those functions return week numbers, not years.
Practical Use Cases
YEAR is commonly used in data cleaning and reporting:
- Grouping transactions by year: Add a helper column with
=YEAR(A2)and then use a pivot table to summarize. - Conditional formatting: Highlight rows where the year is current: select the range, go to Format > Conditional formatting, choose “Custom formula is” and enter
=YEAR($A2)=YEAR(TODAY()). - Filtering: Use a filter view with a custom formula like
=YEAR(A2)=2024to show only 2024 records. - Age calculation: Combine with
DATEDIFto compute age:=DATEDIF(A2, TODAY(), "Y")gives full years, which is more accurate than subtracting years directly.
Frequently Asked Questions
Can YEAR return a two-digit year? No. YEAR always returns a four-digit number, even for dates before 1900. For example, =YEAR("1899-12-31") returns 1899.
What happens if I use YEAR on a cell with time only? If a cell contains only a time, like 14:30, Google Sheets treats it as a date serial of 0.604..., which is December 30, 1899. YEAR returns 1899. To avoid this, ensure the cell has a date component.
Does YEAR work with dates in text format? Only if the text is a valid date string. If not, use DATEVALUE to convert it first. For example, =YEAR(DATEVALUE("2024-01-01")) works, but =YEAR("January 1, 2024") may fail depending on locale.
How do I get the year from a date in a different timezone? YEAR uses the date as stored in the cell, which does not have timezone information. If you import dates from another timezone, they are converted to the spreadsheet's timezone when imported. To adjust, you can add or subtract hours using A1 + TIME(diff,0,0) before applying YEAR.
Can I use YEAR in an array formula? Yes. For example, =ARRAYFORMULA(YEAR(A2:A10)) returns an array of years for each cell in the range. This works in Google Sheets, but in Excel you would need to enter it as a dynamic array formula.
Alternatives to YEAR
If you need the year as text with a suffix like “FY24”, you can use =YEAR(A1) and concatenate: ="FY"&RIGHT(YEAR(A1),2). For fiscal years, use the adjustment shown earlier. If you need the ISO year (used in week numbering), use =YEAR(A1) but note that ISO years can differ from calendar years around New Year. For example, January 1, 2021 belongs to ISO week 53 of 2020, so the ISO year is 2020. Google Sheets does not have a built-in ISOYEAR function, but you can compute it with =YEAR(A1) + (MONTH(A1)=12 AND WEEKNUM(A1,2)=1) for a rough approximation, though this is not always correct for all edge cases.
Related
- Balance Sheet Series 7: What It Is & How to Pass
- Fluid Balance Charting: What It Is and Why It Matters
- Battery Backup Calculation for UPS: How to Size Correctly
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Make a Flowchart in WordThe easiest way to make a flowchart in Word is to insert flowchart shapes, label them, and join…
- Clear Excel Cell Formatting: What Changes and What StaysTo clear formatting in Excel for Microsoft 365 on Windows, select the cells, then choose Home > Clear…
- How to Zoom in Microsoft Excel: Quick Ways to ResizeTo zoom in Microsoft Excel on Windows, use the zoom slider at the bottom-right of the Excel window,…
- Multiple Dependent Dropdowns in Google Sheets: SetupYes. In Google Sheets, you can create multiple dependent dropdowns by using a parent selection to filter a…
- Bi-Monthly Budget Template in Google Sheets: Setup GuideA bi-monthly budget template in Google Sheets can track income, planned spending, and actual expenses for each pay…
- Google Sheets Conditional Formatting With VLOOKUP RulesYes. In Google Sheets, use Format > Conditional formatting, choose Custom formula is, and enter a formula that…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.