Home Privacy Policy Feedback Link to us Site Map Forums

Excel: DateSerial Function (VBA only)


In Excel, the DateSerial function returns a date given a year, month, and day value.

The syntax for the DateSerial function is:

DateSerial( year, month, day )

year is a numeric value between 100 and 9999 that represents the year value of the date.

month is a numeric value that represents the month value of the date.

day is a numeric value that represents the day value of the date.


Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For example:

DateSerial(2004, 6, 30) would return "6/30/2004"
DateSerial(2004-1, 6, 30) would return "6/30/2003"
DateSerial(2004, 6-2, 14) would return "4/14/2004"

VBA Code

The DateSerial function can only be used in VBA code. For example:

Dim LDate As Date

LDate = DateSerial(2004, 5, 31)

In this example, the variable called LDate would now contain the value of "5/31/2004".