WISDOMBYDATA
  • BLOG
    • Blog Guide
    • Blog History
  • EXCEL
    • Functions & Formulas
    • VBA & Macros
    • VLOOKUP
    • Pivot Tables
    • Conditional Formatting
    • Tricks & Shortcuts
  • BI
    • SAP BOBJ/BW
    • Tableau
  • SQL
  • ABOUT
    • About WBD
    • About Me

Calculating Seniority of Active Employees Using MS Excel

11/3/2013

1 Comment

 

I was assigned the task of creating a report that calculates employee seniority some time ago at work. I was able to use various features of MS Excel in order to perform this task. I would like to share this procedure with you. 
​
Note: the data in the table below are doctored and the names I chose are from the cast of one of my favourite movies, 'Club Dread'!
Picture




                                                                   


​Here is the formula that I entered into Excel: 

=IF(F2="Y", INT(YEARFRAC(DATE(2014,1,1), D2)), "Not Active")

This furmala is for the Employee with ID=1 (ID is the unique key) . the same formula must be duplicated for the other four (the value for "F" and "D" must be modified) .The outputs retrieved in order of ID are as follows: NOT Active, 12, 14, 17, and Not Active.

Now lets assume that we only want to look up the seniority of a single employee using his/her ID number. Here is a good formula that serves this purpose. the formula below calculates the seniority of the employee whose ID is equal to 2.

=IF(F2="Y",INT(YEARFRAC(DATE(2014,1,1),VLOOKUP(2,A$2:D$6,4, FALSE))),"Not Active")

Explanation:

the "IF" statement
ensures that seniority is calculated only for those employees who have an active status in column F. Otherwise "Not Active will appear in the output

The "YEARFRAC" statement  calculates the seniority of the employee with ID equal to 2 (or any other ID depending on on the value entered in the VLOOKUP statement) by subtracting the Hire Date from the fiscal year start date (in this example 2014) and displays the result as an integer using the INT function (using INT function is optional. If you want the number to include months as well the INT should be removed). 
​

The "VLOOKUP" Statement searches for a given ID in column A (in this case searches for where ID=2) and whereever a match is found the respective Hire Date in column D will be utilized in the YEARFRAC statement. 


1 Comment
Queensland Singles Events link
1/23/2023 01:18:07 pm

Much appreciate you writing this

Reply



Leave a Reply.

    Categories

    All
    BI
    EXCEL
    MISC
    SQL

    Archives

    June 2020
    May 2020
    April 2020
    March 2020
    February 2020
    December 2019
    November 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    September 2017
    August 2017
    July 2017
    June 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    May 2015
    April 2015
    March 2015
    February 2015
    January 2015
    December 2014
    November 2014
    October 2014
    September 2014
    August 2014
    April 2014
    March 2014
    February 2014
    January 2014
    December 2013
    November 2013

Powered by Create your own unique website with customizable templates.
  • BLOG
    • Blog Guide
    • Blog History
  • EXCEL
    • Functions & Formulas
    • VBA & Macros
    • VLOOKUP
    • Pivot Tables
    • Conditional Formatting
    • Tricks & Shortcuts
  • BI
    • SAP BOBJ/BW
    • Tableau
  • SQL
  • ABOUT
    • About WBD
    • About Me