+ Reply to Thread
Results 1 to 11 of 11

Finding first and last workdays of a given year

  1. #1
    Registered User
    Join Date
    05-25-2017
    Location
    Buchs, Switzlerand
    MS-Off Ver
    2019
    Posts
    75

    Finding first and last workdays of a given year

    Hi,

    From a long column B with all the workdays since 1973, I wish to extract the first and last workday of a given year.
    I have tried various index formulas with max. and min. but so far it hasn't worked out.

    For the first day of a year that is entered in cell V4, I take the 31.12. of the previous year (in V3) and increase the index row by 1:
    =INDEX($B$3:$B$50000;MATCH("31.12."&V3;$B$3:$B$50000;1)+1;1)

    For the last day of that year in cell V4, I take the 31.12.:
    =INDEX($B$3:$B$50000;MATCH("31.12."&V4;$B$3:$B$50000;1);1)

    For some reason the formluas always return the first day of any year as being the 16.11.2023 and the last day the 15.11.2023. Perhaps the formula is wrong altogether and a max(if...) style of formula would help. Perhaps there is also a problem with the formatting of the dates. As far as I can tell, however, the entire colum B is in date format. But for smoe reason something has changed after 15.11.2023.

    Can some explain what is going on and perhaps correct my formulas?

    Best regards,
    Excel_Arate
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: Finding first and last workdays of a given year

    Does this work?

    Array formulas
    in D3
    =MIN(IF(YEAR(B$3:B$50000)=V3,B$3:B$50000))
    in E3
    =MAX(IF(YEAR(B$3:B$50000)=V3,B$3:B$50000))

    and copy down
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    05-25-2017
    Location
    Buchs, Switzlerand
    MS-Off Ver
    2019
    Posts
    75

    Re: Finding first and last workdays of a given year

    Hi,

    Yeah, I was hoping the solution might be like the one you suggested, However, I'm afraid it doesn't work. I have attached the result.
    What's strange is that I get zeros (in date format "00.01.1900") for almost all entries except for 2023 and 2024 and here 3 out of the 4 answers are correct and the fourth one is wrong. Maybe, it's the formatting after all? Can't detect anything though.


    Thank you for trying to help, though.

    Best regards,
    Excel_Arate
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,670

    Re: Finding first and last workdays of a given year

    Please try the following.
    For 1st working day: =WORKDAY.INTL(DATE(V3,1,1)-1,1,1)
    For last working day: =WORKDAY.INTL(DATE(V3,12,31)+1,-1,1)
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    05-25-2017
    Location
    Buchs, Switzlerand
    MS-Off Ver
    2019
    Posts
    75

    Re: Finding first and last workdays of a given year

    Hi JeteMc,

    Thanks a lot, this works better than anything I had so far! Just one question on the workdays. To my understanding, weekends defined as Saturdays and Sundays are taken out using these settings. If I wanted to take out New Years Day I could do that too but would have to deifne on wich weekday it occurred for the last 50 or so years, right? If so, is there another way of doing this?

    Many thanks and best regards,
    Excel_Arate

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,670

    Re: Finding first and last workdays of a given year

    For first working day of the year try: =WORKDAY.INTL(DATE(V3,1,2)-1,1,1,DATE(V3,1,1)) or =WORKDAY.INTL(DATE(V3,1,2)-1,1,1)
    Let us know if you have any questions.
    Last edited by JeteMc; 02-05-2024 at 10:17 AM. Reason: Added second formula

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,410

    Re: Finding first and last workdays of a given year

    Quote Originally Posted by Excel_Arate View Post
    Hi JeteMc,

    Thanks a lot, this works better than anything I had so far! Just one question on the workdays. To my understanding, weekends defined as Saturdays and Sundays are taken out using these settings. If I wanted to take out New Years Day I could do that too but would have to deifne on wich weekday it occurred for the last 50 or so years, right? If so, is there another way of doing this?

    Many thanks and best regards,
    Excel_Arate
    You can create custom weekends and create a list of Holidays. Please see the attached.

    Column C returns years. 1973 goes in C2 and then just add 1 to each row below until 2024.
    Then I put USA holidays in F2:I2. In F2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in G2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in H2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and in I2 (this is a little trickier as it is USA specific for Thanksgiving Day...the 4th Thursday in November)
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    all copied down.

    That should give you an idea ... then substitute your holidays.

    From there on I used the first of each year as and start date to return the 1st and last workdays of each given year. In D2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and in E2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  8. #8
    Registered User
    Join Date
    05-25-2017
    Location
    Buchs, Switzlerand
    MS-Off Ver
    2019
    Posts
    75

    Re: Finding first and last workdays of a given year

    Hi JeteMc, apologies for the late reply. Both versions work well. Thank you very much!
    Best regards,
    Excel_Arate

  9. #9
    Registered User
    Join Date
    05-25-2017
    Location
    Buchs, Switzlerand
    MS-Off Ver
    2019
    Posts
    75

    Re: Finding first and last workdays of a given year

    Thank you, FlameRetired. This works fine and well explained! Sorry, for the late reply.
    Best regards,
    Excel_Arate

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,670

    Re: Finding first and last workdays of a given year

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'.
    Note: As per the formulas in post #6, I suggest using the second formula.
    I hope that you have a blessed day.

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,410

    Re: Finding first and last workdays of a given year

    You are welcome, and again thank you for the feedback and marking your thread Solved.

+ 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. [SOLVED] Excel 2016 List Workdays For Year
    By jfcby in forum Excel General
    Replies: 6
    Last Post: 10-10-2023, 12:34 PM
  2. Replies: 16
    Last Post: 11-04-2019, 04:11 AM
  3. [SOLVED] Monthly workdays, monthly workdays to date & public holidays
    By blackburnsexcel in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-21-2015, 07:08 AM
  4. Input Year and Quarter and receive workdays
    By tracer773 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-16-2014, 06:26 AM
  5. [SOLVED] Finding the Date of the 2nd and 4th Wed.'s in a year.
    By Dwand in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-11-2012, 07:52 PM
  6. Finding the last date of the year
    By thewrathful in forum Excel General
    Replies: 1
    Last Post: 05-02-2010, 02:53 PM
  7. Finding age from year
    By [email protected] in forum Excel General
    Replies: 4
    Last Post: 03-04-2006, 11:55 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