+ Reply to Thread
Results 1 to 8 of 8

Annual Leave Form - Sum the workdays (value of 1) if they fall between Start Day & End Day

  1. #1
    Banned User!
    Join Date
    09-26-2015
    Location
    Manchester
    MS-Off Ver
    2013
    Posts
    218

    Annual Leave Form - Sum the workdays (value of 1) if they fall between Start Day & End Day

    Hi All,

    Please see attached my Annual Leave Form.

    In cell M16 I want to sum the amount of work days (referencing values in column BC) that fall between the Start Date (M12 & U12) and End Date (M14 & U14) of the Annual Leave being requested.

    To give you some background of the premise of column BC:
    - All days of the year are split into two rows - AM and PM
    - Workdays are AM & PM Monday - Friday and also Saturday AM
    - If a row constitutes a workday, it is given a value of 0.5 in column BC
    - If a row constitutes a non-workday (Saturday PM or Sunday AM and Sunday PM) then it is given a value of zero.
    - If a row constitutes a public holiday (see list AR24:AR47) then it is also given a value of zero.

    Cell M16 needs to sum the number of '0.5' workdays that are being requested in an employee's annual leave request. It will need to do this based on the days and AMs/PMs they are requesting off work, as per the Start Date (M12 & U12) and End Date (M14 & U14), probably by using some permutation of COUNTIF, INDEX & MATCH to reference the criteria in M12, U12, M14 and U14 to the values AX & BB & BC (this is the part I'm having problems with).
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2015
    Location
    Uvalde, TX
    MS-Off Ver
    2010
    Posts
    720

    Re: Annual Leave Form - Sum the workdays (value of 1) if they fall between Start Day & End

    Hi Stuartxl,

    I think a SUMIFS will work for you.

    Give this a try:

    Please Login or Register  to view this content.
    Hope this is helpful.

    Cheers

  3. #3
    Banned User!
    Join Date
    09-26-2015
    Location
    Manchester
    MS-Off Ver
    2013
    Posts
    218

    Re: Annual Leave Form - Sum the workdays (value of 1) if they fall between Start Day & End

    Hi Southward,

    I just attempted this and it's not generating the correct results. Take the example I uploaded. The start date being 10 September 2016 AM and the end date being 24 September 2016 AM should generate a result of 11.5 work days. Your formula is giving me a result of 6.5.

    It looks like the reason for this is because your formula instructs the cell to only count either AMs or PMs (depending which AM or PM criteria is showing the start dates/end dates). What I need the formula to do is identify whether the Start date begins at AM or PM and begin counting the '0.5' values from the relevant row, as well as detect whether the End date ends on AM or PM and end counting the '0.5' values on the relevant row, but count ALL AM and PM vales in between these rows.
    Last edited by STUARTXL; 06-25-2016 at 09:55 AM.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Annual Leave Form - Sum the workdays (value of 1) if they fall between Start Day & End

    Try

    =SUM(OFFSET($BC$1,MATCH(M12,AX2:AX1000,0),0,($M14-$M12)*2+1+IF($U12="PM",-1,IF($U14="PM",1,0)),1))

  5. #5
    Valued Forum Contributor
    Join Date
    05-08-2015
    Location
    Uvalde, TX
    MS-Off Ver
    2010
    Posts
    720

    Re: Annual Leave Form - Sum the workdays (value of 1) if they fall between Start Day & End

    Hi Stuartxl,

    I see what you mean. I was wondering the same thing as I formulated the first idea.

    In order to bring the AM/PM into play for excel to calculate between dates taking the AM/PM into consideration I added a helper column. Column BC.
    It looks at Column BB to determine AM/PM and returns the Column AX date into an AM/PM relative value. (wow, very wordy, hope it makes sense.

    The new formula in M16 turns the M12 and M14 into AM/PM relevant date/time values as directed by U12 and U14. Which is strange because U12 and U14 can only be AM values (for now).

    See attached file.

    Hope this works for you.

    Cheers



    P.S. or what John Topley suggested. That sure is pretty.
    Attached Files Attached Files
    Last edited by southward; 06-25-2016 at 10:36 AM.

  6. #6
    Banned User!
    Join Date
    09-26-2015
    Location
    Manchester
    MS-Off Ver
    2013
    Posts
    218

    Re: Annual Leave Form - Sum the workdays (value of 1) if they fall between Start Day & End

    Nevermind, I've managed to achieve my desired result by assigning unique values to each row (AM & PM) for every date. Thanks for your help anyway.

  7. #7
    Banned User!
    Join Date
    09-26-2015
    Location
    Manchester
    MS-Off Ver
    2013
    Posts
    218

    Re: Annual Leave Form - Sum the workdays (value of 1) if they fall between Start Day & End

    Hi John and Southward,

    Both your solutions work perfectly. I only saw your replies after my last post, but thanks for assisting. I think I'll use the solutions provided as my solution involved generating more data, whereas yours work with only the information supplied on my first upload.

    Thanks again.

    PS John, I'm beginning to think you're my guardian angel on this forum - every thread I post has a solution from you! Thank you very much. Unfortunately this forum won't let me add to your reputation anymore, which doesn't seem fair since you seem to be the one helping me the most.
    Last edited by STUARTXL; 06-25-2016 at 11:11 AM.

  8. #8
    Valued Forum Contributor
    Join Date
    05-08-2015
    Location
    Uvalde, TX
    MS-Off Ver
    2010
    Posts
    720

    Re: Annual Leave Form - Sum the workdays (value of 1) if they fall between Start Day & End

    Glad I could be of some assistance

+ 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. Replies: 4
    Last Post: 10-12-2015, 02:15 PM
  2. Annual Leave and Sick Leave fiel
    By lauphyon in forum Excel General
    Replies: 2
    Last Post: 06-24-2014, 05:00 AM
  3. Annual Leave Planner
    By raveepoojari in forum Excel General
    Replies: 37
    Last Post: 06-24-2014, 04:28 AM
  4. Sick leave annual leave minutes spreadsheet
    By News12kim in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-22-2013, 03:28 AM
  5. Annual Leave Calendar
    By SimonGreenwich in forum Excel General
    Replies: 7
    Last Post: 08-25-2011, 07:33 AM
  6. Replies: 1
    Last Post: 05-18-2011, 10:46 PM
  7. Annual Leave
    By Aussie Peter in forum Excel General
    Replies: 1
    Last Post: 01-30-2006, 11:30 PM

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