+ Reply to Thread
Results 1 to 2 of 2

Calculate dates based on complex conditions and produce an outcome- [Excel 2013, VBA/Form

  1. #1
    Registered User
    Join Date
    04-03-2020
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    1

    Question Calculate dates based on complex conditions and produce an outcome- [Excel 2013, VBA/Form

    I have a few columns as below

    Annotation 2020-04-04 021514.jpg

    The above table shows example of temporary freelancer employment details of Dory, Zack and Adam. The "Employment Status" column indicates "Exited" for the past employment(s) of a person to a particular "Company" and "Active" if the same person is currently employed in the same "Company". The main condition here is that each person can be employed in the same company for a maximum of 8 months (or 30*8 days) only, subject to the below conditions:
    1. Excel should calculate the threshold duration of 8 months for a person from the first date of employment in the same company which in the above case is 27-SEP-19 for Dory and Zack and 04-MAR-20 for Adam (Column "Date of employment").
    2. However, if there is a difference of at least 1 month (or 30 days) between 2 consecutive employments in the same company for the same person (Date of employment minus previous date of transfer = or > 30 days) then excel should ignore the previous employments and start calculating the threshold date from the date of employment after the most recent break period has been achieved.
    in the above table example, this is still going to be calculated from 27-SEP-19 for Dory since she does not have a minimum 1 month duration between her consecutive employments and excel should display 24-MAY-20 (i.e. 27-SEP-19 plus 8 months) in column "Threshold" in the same row as "Active" employment status but for Zack it will be calculated from 24-NOV-19 since he has a difference of at least 1 month (minimum 30 days) between his second and first employment and excel should display 21-JUL-20 (i.e. 24-NOV-19 plus 8 months) in column "Threshold" in the same row as "Active" employment status.

    Now there could be many more companies that n number of persons could have worked for but I am only concerned where the person has an active employment status in a company irrespective of how many past employments they had in the same company or even if they didn't have any past employments in the company like in the case of Adam. At the end Excel should calculate the threshold for each person's employment in the same company subject to the above conditions and return the outcome in column "Threshold". I am relatively new to VBA and I have no idea how to make this work. Can someone help? If this can be achieved by just formula can someone show me how?

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Calculate dates based on complex conditions and produce an outcome- [Excel 2013, VBA/F

    Administrative note

    Welcome to the forum

    in your haste to solve your problem, you probably missed the yellow banner advising how to get answers faster by posting a sheet ?

    Please take a moment to read it and attach a sheet accordingly.

    Thanks you for helping us help you

+ 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] Provide Outcome based on three conditions.
    By masond3 in forum Excel General
    Replies: 15
    Last Post: 02-21-2019, 09:21 AM
  2. [SOLVED] Displaying difference between dates based on outcome of calculation
    By SilvM in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-20-2017, 01:58 AM
  3. How can I accomplish the below outcome in MS Excel 2013?
    By Shashank Angadi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-08-2016, 01:30 PM
  4. Replies: 3
    Last Post: 10-29-2013, 04:49 PM
  5. Replies: 3
    Last Post: 05-18-2012, 03:12 PM
  6. [SOLVED] Need Excel to calculate days and then send email based on outcome
    By TYOsborn in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-30-2012, 05:55 PM
  7. Excel Outcome Subject to Two Conditions?
    By demon8991 in forum Excel General
    Replies: 3
    Last Post: 09-30-2009, 06:28 AM

Tags for this Thread

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