+ Reply to Thread
Results 1 to 8 of 8

Determining Years EE is Active Based on Hire/Term Dates

  1. #1
    Registered User
    Join Date
    11-06-2014
    Location
    NJ
    MS-Off Ver
    Office 2010
    Posts
    4

    Determining Years EE is Active Based on Hire/Term Dates

    I feel this is something simple and I am just missing something here, but I wanted to figure out what years and Employee is Active based on Hire and Term Dates. My Spreadsheet is basically setup like below.

    Please Login or Register  to view this content.
    For this particular spreadsheet I want to figure out who was active in 2011, 2012 and 2013. I would like to return a value in the fourth column, that shows what years they are active. So my final product might look something like this.

    Please Login or Register  to view this content.
    I know i could write some sort of Macro for this, but i was hoping to see if i could do with just formulas if possible. Any help is greatly appreciated.
    Last edited by JBeaucaire; 11-06-2014 at 11:49 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Determining Years EE is Active Based on Hire/Term Dates

    If you can live with a trailing , here and there, this not too horrible array formula can do it, in D2:

    =IF(ISNUMBER(MATCH(2011,ROW(INDIRECT(YEAR(B2)&":"&IF(C2="Active", YEAR(TODAY()), YEAR(C2)))),0)),"2011,", "") &
    IF(ISNUMBER(MATCH(2012,ROW(INDIRECT(YEAR(B2)&":"&IF(C2="Active", YEAR(TODAY()), YEAR(C2)))),0)),"2012,", "") &
    IF(ISNUMBER(MATCH(2013,ROW(INDIRECT(YEAR(B2)&":"&IF(C2="Active", YEAR(TODAY()), YEAR(C2)))),0)),"2013", "")


    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    11-06-2014
    Location
    NJ
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: Determining Years EE is Active Based on Hire/Term Dates

    Thanks so much JB. It works when i put the formula in on my basic test sheet. The test sheet looks just like the example above. However, when i copy this into my actual file (changing the B2 and C2 cell references for the correct cells), i get a blank cell. The formula is in there as an array, just returns a blank cell. any clue why that could be?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Determining Years EE is Active Based on Hire/Term Dates

    No, not without seeing it.

    Attach a sample workbook. Make sure there is just enough data to demonstrate the problem.
    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  5. #5
    Registered User
    Join Date
    11-06-2014
    Location
    NJ
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: Determining Years EE is Active Based on Hire/Term Dates

    Here is an Example JB. Column I would be where i want the Formula that you created. Like i stated before, if i enter the formula on a new sheet with new data it worked, but when i put the formula in my sheet it does not work. Thanks in advance for your help.
    Attached Files Attached Files

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Determining Years EE is Active Based on Hire/Term Dates

    Wow, I installed that formula in your workbook and it gets a #Value error right in the very first INDIRECT() evaluation of the YEAR in the E10. I've never seen that before. I guess we need to add additional plumbing to insure the years are treated as text initially.


    =IF(ISNUMBER(MATCH(2011,ROW(INDIRECT(TEXT(YEAR(E10),"0000")&":"&IF(F10="Active", TEXT(YEAR(TODAY()),"000"), TEXT(YEAR(F10),"0000")))),0)),"2011,", "") &
    IF(ISNUMBER(MATCH(2012,ROW(INDIRECT(TEXT(YEAR(E10),"0000")&":"&IF(F10="Active", TEXT(YEAR(TODAY()),"000"), TEXT(YEAR(F10),"0000")))),0)),"2012,", "") &
    IF(ISNUMBER(MATCH(2013,ROW(INDIRECT(TEXT(YEAR(E10),"0000")&":"&IF(F10="Active", TEXT(YEAR(TODAY()),"000"), TEXT(YEAR(F10),"0000")))),0)),"2013,", "")

  7. #7
    Registered User
    Join Date
    11-06-2014
    Location
    NJ
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: Determining Years EE is Active Based on Hire/Term Dates

    Worked Great JB. Thanks so much. If you get a chance, could you explain the basic syntax behind this fomula...just want to make sure i can fully understand it so i can apply to future spreadsheets.

    Again thank you!

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Determining Years EE is Active Based on Hire/Term Dates

    You can use the function Formulas > Evaluate Formula to watch that formula unfold, I use that tool daily to confirm my calculations are doing what they should.

    Typically a formula runs through all the individual calculations one time. An array formula, properly constructed, can spit out numerous calculations in one formula where only one occurs normally.

    To see this in its simplest form, put some random numbers in A1, A2, A3 and B1.
    Then in an empty cell enter this regular formula, then use the Evaluate function to watch it calculate:
    =SUM(A1*B1)

    Now enter this array formula with CSE (Ctrl-Shift-Enter) in another cell, then Evaluate it:
    =SUM(A1:A3*B1)

    I always find it cool to see the {array} appear in the middle of the formula and start running multiple calculations.


    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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: 1
    Last Post: 10-23-2014, 08:10 AM
  2. Forecast How Many Employees To Hire Based on Active and Termed Employees
    By Kanook22 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-12-2014, 01:19 PM
  3. [SOLVED] Sum man years with hire dates available
    By franzzo in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-13-2013, 03:11 AM
  4. Replies: 2
    Last Post: 05-30-2012, 10:53 AM
  5. [SOLVED] add a hire date to the end of year (12/31/05) and get Total years
    By Sohoma Knome in forum Excel General
    Replies: 2
    Last Post: 12-28-2005, 11:25 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