Description
The Microsoft Excel WEEKDAYNAME function returns a string representing the day of the week given a number from 1 to 7.
Syntax
The syntax for the WEEKDAYNAME function in Microsoft Excel is:
WeekdayName( number, [abbreviate], [firstdayofweek] )
Parameters or Arguments
- number
- A value from 1 to 7, representing a day of the week.
- abbreviate
- Optional. This parameter accepts a boolean value, either TRUE or FALSE. If this parameter is set to TRUE, it means that the weekday name is abbreviated. If this parameter is set to FALSE, the weekday name is not abbreviated.
- firstdayofweek
- Optional. It determines what day is to be the first day of the week. If this parameter is omitted, it assumes that the first day of the week is Sunday. It can be any of the following values:
Constant Value Explanation vbUseSystem 0 Use the NLS API settings vbSunday 1 Sunday (default used) vbMonday 2 Monday vbTuesday 3 Tuesday vbWednesday 4 Wednesday vbThursday 5 Thursday vbFriday 6 Friday vbSaturday 7 Saturday
Note
- If you use the WEEKDAYNAME function in a query, you'll have to use the numeric value (ie: 0 to 7) for the firstdayofweek parameter. You can only use the constant equivalent (ie: vbSunday to vbSaturday) in VBA code.
Applies To
- Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
- VBA function (VBA)
Example (as VBA Function)
The WEEKDAYNAME function can only be used in VBA code in Microsoft Excel.
Let's look at some Excel WEEKDAYNAME function examples and explore how to use the WEEKDAYNAME function in Excel VBA code:
WeekdayName(3) Result: 'Tuesday' WeekdayName(3, TRUE) Result: 'Tue' WeekdayName(3, TRUE, vbMonday) Result: 'Wed' WeekdayName(3, TRUE, 2) Result: 'Wed'
For example:
Dim LValue As String LValue = WeekdayName(3, TRUE, vbMonday)
In this example, the variable called LValue would now contain the value of 'Wed'.