Excel’s DATE() function is a typical example of a function that you will probably only ever use in conjunction with other functions to create a solution to a problem. Date (and time) values are particularly tricky values to work with as they are non-decimal; remember when your primary school teacher told you that you can’t add apples and oranges?
While the DATE function builds up a date, the DAY, MONTH and YEAR functions break a date apart.
In this post:
Required knowledge:
1. Syntax
=DATE(year,month,day)
2. Example
In the example below, both cells A2 & B2 contain date values. To work out if the dates are the same except for the year, we need to separate the dates into their year, month and day components. Once we have the day part of the 2 dates, we can compare them to see if they are the same; once we have the month part of the 2 dates, we can do the same. We ignore the year parts as in this example we are trying to work out if it is someone’s birthday.


=IF(AND(MONTH(A2) = MONTH(B2), DAY(A2) = DAY(B2)), "HAPPY BIRTHDAY!", "Sorry, it's not your day.")
3. Next steps
Use Excel’s TODAY() function to make the above solution dynamic!
References:
- Microsoft (no date) DATE function | Microsoft Support. Microsoft. Available at: https://support.microsoft.com/en-us/office/date-function-e36c0c8c-4104-49da-ab83-82328b832349. (Accessed: February 20, 2023).