+ Reply to Thread
Results 1 to 7 of 7

formula to return week commencing

  1. #1
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    formula to return week commencing

    i would like for excel to recognise a date in cell a1
    lets say today 23/01/09 and return the answer "w/c 19/01/09"
    weeks start on a monday and dates input will only be between monday to friday
    so any data inputted should look for and return the monday before as per previous example

    kind regards
    Last edited by excellentexcel; 01-23-2009 at 03:58 AM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    ="W/C "&TEXT(A1-(WEEKDAY(A1)-2),"DD/MM/YY")
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    sorry vba
    that is perfect but what i forgot to say was
    that what i need is if a cell has a saturday or sunday date in it i need it to say something like "incorrect date that is a weekend"

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    and dates input will only be between monday to friday
    You specified it won't be a weekend

    Use data validation to restrict user inputing a weekend

    =WEEKDAY(A1,2)<=5
    VBA Noob

  5. #5
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    thanks vba
    yes i did say dates would only be monday to friday
    but thats if i enter them and if someone else uses it they might accidently put a weekend in.
    but thanks very much that works

  6. #6
    Registered User
    Join Date
    01-16-2009
    Location
    Texas
    MS-Off Ver
    2013, 2015, 2016
    Posts
    43
    Hows this:


    =IF(((WEEKDAY(TODAY(),2))>=6),"INVALID DATE, WEEKEND",(SUM(TODAY()-(WEEKDAY(TODAY(),2)))))

  7. #7
    Registered User
    Join Date
    04-22-2006
    Posts
    29
    =IF(WEEKDAY(A1,2)>5,"incorrect date that is a weekend","W/C "&TEXT(A1-(WEEKDAY(A1)-2),"DD/MM/YY"))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1