# Beginner question - Add date condition to a formula

Solved
764 3
cancel
Showing results for
Did you mean:
4 - Data Explorer

Hi

I'm looking to create a new field or to modify an existent one.

As of 2022, this formula was okay but in 2023, the value for H sould now be 45.94 instead of 39.27 .

Because we don't want it to have an impact on our reports and on our Page Designer, we need to add a condition that if the event took place in 2022, H = 39.27 and if the event took place after december 31th 2022, H= 45.94.

Could someone help me? I've been trying different things but it seems that I always forget something. Thanks a lot !

1 Solution

Accepted Solutions
8 - Airtable Astronomer

The H Value field has a simple formula that grabs the year from the date, and then assigns the value. The formula is:

IF(YEAR({Date})<=2022, 39.27, 45.94)
Note that if the Date field is empty, it will still return a value of 45.94. You could nest the formula inside of another IF statement to show nothing if the Date field is empty:
IF((Date), IF(YEAR({Date})<=2022, 39.27, 45.94), "")

3 Replies 3
8 - Airtable Astronomer

The H Value field has a simple formula that grabs the year from the date, and then assigns the value. The formula is:

IF(YEAR({Date})<=2022, 39.27, 45.94)
Note that if the Date field is empty, it will still return a value of 45.94. You could nest the formula inside of another IF statement to show nothing if the Date field is empty:
IF((Date), IF(YEAR({Date})<=2022, 39.27, 45.94), "")

4 - Data Explorer

Wow, thank you so much!! It worked 😊

8 - Airtable Astronomer

Happy to help!