Hey Data friends! Today we will learn how to extract the year from a date field using the YEAR formula. The formula is very straightforward to use, but that means it’s not as flexible as other formulas that can extract the year from a date. If you’d like to learn using a more flexible formula, then head over to the tutorial on the Text formula for Year extraction.
Let’s get started!
=Year( DateField )
Where I have DateField, you’d set the cell of the date you need to pull the year from. Let’s walk through an example so we can see the formula in action.
The sample data we will be working with is below:
This is the same data from our Date Difference tutorial. In that tutorial we calculated the date difference between the Course Start Date and the Course End Date. Today, we will use this data to extract the year from the Course Start Date field.
I added a column where we will type our YEAR formula.
Using our year extract formula, we can type out the syntax as follows:
What we’re telling Excel with this formula is that we want it to look at the Course Start Date Field (cell C5) and we want it to extract the year. Our output looks like this:
We can run this formula all the way down the table to see it in action. I changed some of the years around (the cells in pink) from the original sample table, since all years were originally 2022 and that doesn’t make for a fun example of the TEXT formula at work. The output looks like the below:
That’s all there is to it, we’ve successfully extracted the year from a date field!
As always, if you have any questions or need anything clarified you can reach me through my DMs on Twitter @Cest_Nick; otherwise, I’ll catch you on the next post!