# How can I extract the year from a date using a data column?

**URL:** https://community.glideapps.com/t/how-can-i-extract-the-year-from-a-date-using-a-data-column/19103
**Category:** Ask for Help
**Created:** [November 29, 2020, 11:26am UTC](https://community.glideapps.com/t/how-can-i-extract-the-year-from-a-date-using-a-data-column/19103 "2020-11-29T11:26:11Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)
#### Post date: [November 29, 2020, 11:26am UTC](https://community.glideapps.com/t/how-can-i-extract-the-year-from-a-date-using-a-data-column/19103/1 "2020-11-29T11:26:11Z")

</div>

I have a list of projects with dates. I would like to filter the items shown by their year, e.g. 2019, 2020…

I assume the best way is to create a new column in the data sheet. However, I cannot work out how to extract the year. The If, then, else function should work since it recognizes dates but I can’t set up the arguments.

I know the workaround is to add a column in my google sheet and use Year() but this means I have to copy down the formula a thousand times, just in case my project list grows and grows.

Isn’t there a way to extract the year using a new data column?

Thanks in advance for any pointers.

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [November 29, 2020, 11:54am UTC](https://community.glideapps.com/t/how-can-i-extract-the-year-from-a-date-using-a-data-column/19103/2 "2020-11-29T11:54:38Z")

</div>

> [@Simon\_Hill](#):
>
> I know the workaround is to add a column in my google sheet and use Year() but this means I have to copy down the formula a thousand times, just in case my project list grows and grows.

If you want to use this approach, just use it with an Arrayformula to copy the formula as new rows are added. Something like:

={“Column Title”; ARRAYFORMULA(IF: A2:A=“”,“”,YEAR())}

If you want to keep it all in Glide, I think you could probably create a split column that looks at a Date column in Medium format. This could split that date column at the comma, then you might be able to grab the 4 digit year value from there. I haven’t fully thought this through though… so I don’t really know how to do this in full.

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [November 29, 2020, 12:01pm UTC](https://community.glideapps.com/t/how-can-i-extract-the-year-from-a-date-using-a-data-column/19103/3 "2020-11-29T12:01:15Z")

</div>

More info on Arrayformula here.

> [@Tutorial: Arrayformula in Google Sheets, good practices & how to overcome Arrayformula restrictions with scripts](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727):
>
> Hi, Today I will show you the script that can make copying formulas down work, when it does not work with arrayformula. But first, let’s have some introductions about arrayformula, for those who has not used this before in Google Sheets, some equivalents in Glide and some good practices while using it. I hope it can help you in building your Glide apps as well as applying it in your normal day job. 
> 
> > **1/ Definition**
> >
> > Arrayformula is defined as “a range, mathematical expression using one cell range …

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [November 29, 2020, 4:04pm UTC](https://community.glideapps.com/t/how-can-i-extract-the-year-from-a-date-using-a-data-column/19103/4 "2020-11-29T16:04:14Z")

</div>

Create a math column in the glide data editor and use the year(date) formula. You don’t have to do any of this in the google sheet.

---

<div class="post-metadata">

### Author: ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)
#### Post date: [November 30, 2020, 6:46am UTC](https://community.glideapps.com/t/how-can-i-extract-the-year-from-a-date-using-a-data-column/19103/5 "2020-11-30T06:46:50Z")

</div>

Thanks so much Jeff… it worked like a dream!
