The Google Sheets function DATE is a powerful tool that creates a date value from individual components: year, month, and day. This function is particularly useful when you have separate values and need to combine them into a single date format, which can be essential for data analysis, calculations, and organizing schedules.
Syntax
DATE(year, month, day)
- year: A four-digit number representing the year.
- month: A number from 1 to 12, indicating the month. Values outside this range will cause an error.
- day: A number that indicates the day of the month. Values that exceed the number of days in the specified month will automatically roll into the next month.
Example #1
DATE(2023, 10, 31)
This function takes the year 2023, the month of October (10), and the day 31, producing the date October 31, 2023 as a result.
Example #2
DATE(2024, 2, 29)
This example uses the year 2024, which is a leap year, so it returns February 29, 2024 successfully instead of an error.
Example #3
DATE(2023, 13, 1)
Attempting to create a date for the 13th month will result in an error since valid months range from 1 to 12.
Error handling
- NUM!: This error occurs when the year, month, or day values provided are out of valid range. For instance, using a month value of 13 or a negative day value will trigger this error.
- VALUE!: This error arises when the inputs are not numbers. If text or other non-numeric data types are given, the function cannot process them, resulting in this error.
- ERROR!: An ambiguous error that may result from a range of invalid inputs that do not fit the expected structure.