Results 1 to 5 of 5

Thread: Day function

  1. #1
    Star Lounger
    Join Date
    Jun 2002
    Location
    London, Gtr London, England
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Day function

    Hello.

    Is there a function that will display the day from a date?
    ie 'Tuesday' from '23/1/01'

    Thanks

  2. #2
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Day function

    Format Cells/Number tab/Custom and enter:
    dddd

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Day function

    If you just want to display the day of the week, format the cell with the full date

    eg, if the cell conatins "1-jan-01", select it, the from the menu, Format,Cells, Custom, and enter "dddd"

    If you want to test the day of the week, use the formula in another cell "=weekday(SourceCell)". That will give you a number 1-7, where 1 = Sunday
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  4. #4
    Star Lounger
    Join Date
    Jun 2002
    Location
    London, Gtr London, England
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Day function

    nice one!

    How about a function that calculates the Tuesdays of each month for a couple of years?

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Day function

    Hi,
    Not sure what you want to do with it, but this will list every Tuesday from now until 21st Jan 2003 in the first column of the first sheet of the active workbook:
    Sub ListTuesdays()
    Dim dblDateSerial As Double, lngDateAdd As Long, intRow As Integer
    dblDateSerial = CDbl(Date)
    intRow = 1
    For lngDateAdd = 1 To 730
    If Application.WorksheetFunction.Weekday(dblDateSeria l + lngDateAdd, 1) = 3 Then
    ActiveWorkbook.Sheets(1).Cells(intRow, 1).Formula = CDate(dblDateSerial + lngDateAdd)
    intRow = intRow + 1
    End If
    Next 'lngDateAdd
    End Sub
    Any use?
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •