+ Reply to Thread
Results 1 to 4 of 4

explain my formula and HOW it works (please)

  1. #1
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    846

    explain my formula and HOW it works (please)

    Evening all,

    Please Login or Register  to view this content.
    Could someone please explain to me exactly how this formula works?
    If i put this formula in Excel today (monday) it will show me monday, if i change the 3 to a 2, it shows as sunday, if i change the 2 to a 1, it shows as saturday - but wont accept any other number?

    Regards

    Rich

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: explain my formula and HOW it works (please)

    cilck on that cell, then click in teh Fx button to the left of ther formula bar.
    A window will pop up showing you the syntax and expected inputs of that formula. click o the WEEDAY part, and then click into the "return type" bar...it will explain to you what it is doing and the expected inputs need to be

    You can use this on any function to see what you need to use
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: explain my formula and HOW it works (please)

    If you look in the help for the Weekday formula (click the fx symbol in the formula bar) you'll read that there are three parameter values, 1,2 or 3


    With 1 as the parameter the formula will return a value from 1 to 7 where 1 is Sunday and 7 is Saturday
    With 2 as the parameter the formula will return a value from 1 to 7 where 1 is Monday and 7 is Sunday
    With 3 as the parameter the formula will return a value from 0 to 6 where 0 is Monday and 6 is Sunday

    Hence if today is Monday with 3 as the parameter then you are deducting 0 from Today which still leaves the result at Monday
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: explain my formula and HOW it works (please)

    If you want to return the last instance of a specific weekday then you can add a value to TODAY() within the WEEKDAY function, rather than using the second argument of WEEKDAY, in that way you can return the last instance of any day, e.g. this formula will return the last Saturday on or before today

    =TODAY()+1-WEEKDAY(TODAY()+1)

    Now change +1 at the end to +2 and you get the last Friday on or before today, i.e.

    =TODAY()+1-WEEKDAY(TODAY()+2)

    Similarly +3 will give the last Thursday, +4 the last Wednesday....and so on
    Audere est facere

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Explain How Specific R1C1 Formula Works
    By chouston in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-03-2013, 02:32 PM
  2. Can someone please explain how this VBA works? fast-vba-fuzzy-scoring-algorithm
    By LightingPop in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-08-2013, 04:00 AM
  3. Replies: 3
    Last Post: 11-08-2012, 09:00 AM
  4. [SOLVED] Can Someone Explain how this formula works?
    By Brightspark in forum Excel General
    Replies: 4
    Last Post: 06-08-2012, 03:40 PM
  5. Explain how vlookup works
    By rajesh.chandra in forum Excel General
    Replies: 2
    Last Post: 07-10-2009, 09:51 AM

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