+ Reply to Thread
Results 1 to 3 of 3

Conditional Date Calculation after conditions have been checked

  1. #1
    Registered User
    Join Date
    12-01-2014
    Location
    Kansas
    MS-Off Ver
    2010
    Posts
    2

    Question Conditional Date Calculation after conditions have been checked

    I'm trying to write a formula to calculate how many days an employee worked here and if they started training. Below the requirements:

    1. Our work week is Monday - Saturday
    2. No shows have the same start and end date
    3. There is a toggle field with Y or N if they started training or not.
    4. If they did not start training, the start and end date of employment are the same and should return "0"
    5. If they did start training and the start date is >= the end date, it should return the number of days worked, however, IF the start and end date are the same and they started training, the result would be 1

    Currently, if I use this formula it will only count the days between the start and end date and if the start and end date are the same, it will return 1, but doesn't check if training was started or not. If training was not started, and the two dates are the same it should return 0.

    Here is what I have, but it's not working...

    Column I = Start Date
    Column M = Term Date
    Column H = Training Started "Y" or "N"

    =IF(OR(I328<=M328,I328>M328),”0”, IF(H328="Y",=SUM(INT((WEEKDAY(I328-{2,3,4,5,6,7})+M328-I328)/7))))

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Conditional Date Calculation after conditions have been checked

    You don't mention some possible combinations but I will assume that is because they never happen.
    =IF(H328="N", 0, IF(H328 = "Y",NETWORKDAYS(I328, M328),""))
    This will give a 1 if start and term are the same (and training = Yes). It counts the first day as 1 so if there is a difference of 1, then the employee has worked 2 days. Does this work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    12-01-2014
    Location
    Kansas
    MS-Off Ver
    2010
    Posts
    2

    Re: Conditional Date Calculation after conditions have been checked

    Thank you for your response. I think I have solved my problem with the formula below. The problem with the NETWORKDAYS is it excludes Saturday and Sunday, so I used the WEEKDAY function to select which days of the week to calculate, we work Monday-Saturday. I added the ISBLANK to check if either the start or term date are blank it will leave the Days Worked Cell blank vs an invalid number. I'm going to do some error checking now, but so far this seems to have worked.

    =IF(H328="N","0", IF(OR(ISBLANK(I328),ISBLANK(M328)),"",IF(H328="Y", SUM(INT((WEEKDAY(I328-{2,3,4,5,6,7})+M328-I328)/7)))))

+ 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] Conditional format icons based on multiple date conditions
    By fb2003 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-23-2014, 09:21 AM
  2. Replies: 1
    Last Post: 03-12-2014, 08:45 AM
  3. Check Box that shows options in Combo Box if Checked, and Hides if Not Checked
    By dumbjodie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-13-2013, 10:06 AM
  4. Replies: 29
    Last Post: 02-26-2013, 02:13 PM
  5. Automatic Calculation:checked the button
    By Jazzzbo in forum Excel General
    Replies: 5
    Last Post: 09-14-2010, 07:18 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