+ Reply to Thread
Results 1 to 6 of 6

Need a formula for returning row if employee worked in a certain year

  1. #1
    Registered User
    Join Date
    01-04-2013
    Location
    San Francisco
    MS-Off Ver
    Excel 2007
    Posts
    2

    Need a formula for returning row if employee worked in a certain year

    I've been knocking this about all day, and am coming up short.

    In brief, lets say I have the following:

    Column A has an employee name.
    Column B has their original hire date. (i.e. 11/12/2007)
    Column C has their termination date. (i.e. 09/14/2014)

    I am trying to separate an enormous spreadsheet into one which shows all employees who were employed during 2011, 2012, 2013 and 2014. In the example above (11/12/2007 through 9/14/14) that person should show up on queries for 2011, 2012, 2013, and 2014.

    I am looking to find a way to create a formula which would look at the range of dates between Column B and C, and set a variable that says only return row if 2011 is included in that range. There are all sorts of reasons my various attempts haven't worked, but I'm nagged with the feeling that this should be easier than I'm making it.

    Any assistance would be invaluable!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Need a formula for returning row if employee worked in a certain year

    Hi, welcome to the forum

    A formula for this would be fairly simple, but have you considered using filters (very basic) or a Pivot Table (basic/intermediate)?

    If this is something you thing would help, let me know and I can walk you through the process - if you dont already know how
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,666

    Re: Need a formula for returning row if employee worked in a certain year

    Here is an example of a formula that you could use:
    Please Login or Register  to view this content.
    Having very little idea of how your query would be arranged I took the liberty of attaching a small worksheet to show how the formula might be applied:
    Return row if employed.xlsx
    Let me know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Need a formula for returning row if employee worked in a certain year

    Hi Particle Noun and welcome to the forum,

    I envision you problem like the attached. I've created some random hire and end dates and then build a table to the left to show if they were working on the first of that year. Then down at the bottom is the count of employees working on those dates. See if this helps.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Need a formula for returning row if employee worked in a certain year

    JeteMc has a much better answer that uses the end of year date.

    See if his answer works better than mine. Try

    Please Login or Register  to view this content.
    Also, I have a small problem with this problem and my answer. If an employee start date was 12/30/2015, should they be counted as having worked in 2015?
    Last edited by MarvinP; 12-05-2015 at 09:35 AM.

  6. #6
    Registered User
    Join Date
    01-04-2013
    Location
    San Francisco
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Need a formula for returning row if employee worked in a certain year

    Thanks everyone for the responses, it has been so helpful! In the end, I used a combination of Marvin's and JeteMc's formula, with a few extra tweaks:

    =IF(AND($G2<=DATE(X$1,12,31),(IF(ISBLANK($I2), "12/7/2015", $I2))>=DATE(X$1,1,1)),X$1,""). I found that a number of employee's didn't have a termination date, so added in the bit to change any blank determination dates to today's date (which doesn't have to update each time I open it, so I just hardcoded that date).

    I can't thank you all enough, what a great community!

+ 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. Formula to find the employee and calcualte Hours worked
    By rizmomin in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-27-2014, 02:23 PM
  2. [SOLVED] Annual employee salary increase - after one full year of service -- formula
    By macrorookie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-21-2014, 04:26 PM
  3. Formula to add total hours employee worked for each day.
    By rizmomin in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 12-23-2013, 06:10 PM
  4. Calculating total overtime hours worked per employee
    By markjmcl in forum Excel General
    Replies: 3
    Last Post: 09-07-2011, 06:49 PM
  5. vacation accrual formula based on previous year avg hours worked
    By lfox in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-05-2009, 03:41 PM
  6. [SOLVED] Counting the days worked in a month by employee
    By Curtis in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-08-2005, 01:20 PM
  7. [SOLVED] Tracking employee time and jobs worked on daily.
    By shawleigh in forum Excel General
    Replies: 0
    Last Post: 10-10-2005, 06:05 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