+ Reply to Thread
Results 1 to 10 of 10

Formula with conditions?

  1. #1
    Registered User
    Join Date
    12-15-2008
    Location
    in a mud hut
    Posts
    28

    Formula with conditions?

    I am struggling with a way to calculate some complex leave.

    our sickness policy is as follows

    in a 12 month period staff are only allowed 10 consecutive days off before they are put on an action plan OR 4 separate occasion within a 12 month period before they are put on an action plan.

    I am trying to find to construct a formula that can do the below.

    1) 10 consecutive days within a 12 month period
    2) 4 separate occasions within a 12 month period

    If both the above are achieved a way of alerting would be advantageous

    What would be the best way of capturing this information? also i need a way to capture the dates of absence as well.

    Thanks for your thoughts

  2. #2
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Formula with conditions?

    Can you provide or attach a sample of the data, along with the expected results?

  3. #3
    Registered User
    Join Date
    12-15-2008
    Location
    in a mud hut
    Posts
    28

    Re: Formula with conditions?

    i have attached a sample. I am looking for the best way to capture the dates of sickness. This is what is throwing me at the moment.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-07-2009
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Formula with conditions?

    Here's one way to start looking at it. I suggested my own way of handling the off days, as you were uncertain about it.

    If you're ok with this data pattern, there's one more thing left to do: make sure the formula in column E updates accordingly, when there's less than 4 occasions (e.g. 3) and one of them is more than 10 days (meaning, the formula would have output the same thing for all the 3 rows of that person).

    You'll also have to tweak the Days column to account for the year start and end (for when a person is on leave before the year end, and comes back after).
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Formula with conditions?

    Here's another way... In the attached sample file, you'll notice that for simplicity I entered the dates for the entire year but only included data for a few months. You'll also notice that sick days are indicated by entering an 'S' for the relevant date. Note that I assumed that the relevant days are Monday through Friday. So this means that if someone is sick on Friday and the following Monday, it's considered as one instance.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-15-2008
    Location
    in a mud hut
    Posts
    28

    Re: Formula with conditions?

    Domenic,

    That's pretty much what I am looking for except our week is a full seven days. Could the formula incorporate this?

    Many Thanks

    Andy

  7. #7
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Formula with conditions?

    Try...

    B4, confirmed with CONTROL+SHIFT+ENTER, and copied across:

    =SUM(IF(FREQUENCY(IF(B$9:B$373="S",ROW(B$9:B$373)),IF(B$9:B$373<>"S",ROW(B$9:B$373))),1))

    B5, confirmed with CONTROL+SHIFT+ENTER, and copied across:

    =SUM(IF(FREQUENCY(IF(B$9:B$373="S",ROW(B$9:B$373)),IF(B$9:B$373<>"S",ROW(B$9:B$373)))>=10,1))

  8. #8
    Registered User
    Join Date
    12-15-2008
    Location
    in a mud hut
    Posts
    28

    Re: Formula with conditions?

    mmm.... I have tried this and its throwing out an error, maybe i am doing something wrong. I have attached what i have done.

    Thanks for help, much appreciated.
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Formula with conditions?

    The formula needs to be confirmed with CONTROL+SHIFT+ENTER, instead of just ENTER. In other words, press down both the CONTROL and SHIFT keys, then while both keys are pressed down, press the ENTER key. If done correctly, Excel will automatically place curly braces {...} around the formula.

  10. #10
    Registered User
    Join Date
    12-15-2008
    Location
    in a mud hut
    Posts
    28

    Re: Formula with conditions?

    Oh i was doing it wrong, thanks for that got it working now.

+ 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