IF statement that returns a category name based on start date & end date

maxim642

Board Regular
Joined
Feb 4, 2021
Messages
91
Office Version
  1. 365
Platform
  1. MacOS
I'd like to be able to group employees that have left the company into "tenure groups" based on the length of time they were with the company.

The below table is an example of my dataset. The "tenure groups" are "0-6 months", "6-12 months", "1-5 years", and "5 years+". If an employee's end date is blank, that means they are still with the company (so perhaps a TODAY function would be inserted to calculate length of service). Thank you.

Employee IDStart DateEnd DateTenure Group
Emp201/12/201931/12/2021
Emp324/07/201601/11/2016
Emp411/04/201001/12/2019
Emp530/09/2021
Emp617/01/2022
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
josros (1).xlsm
ABCDEFG
1
2Employee IDStart DateEnd DateTenure Groupmonthsdescription
3Emp21/12/201931/12/20211-5 years00-6 months
4Emp324/07/20161/11/20160-6 months66-12 months
5Emp411/04/20101/12/20195 years+121-5 years
6Emp530/09/20210-6 months605 years+
7Emp617/01/20220-6 months
8
Blad1
Cell Formulas
RangeFormula
D3:D7D3=VLOOKUP(DATEDIF(B3,IF(C3="",TODAY(),C3),"m"),$F$3:$G$6,2,1)
 
Upvote 0
Solution
josros (1).xlsm
ABCDEFG
1
2Employee IDStart DateEnd DateTenure Groupmonthsdescription
3Emp21/12/201931/12/20211-5 years00-6 months
4Emp324/07/20161/11/20160-6 months66-12 months
5Emp411/04/20101/12/20195 years+121-5 years
6Emp530/09/20210-6 months605 years+
7Emp617/01/20220-6 months
8
Blad1
Cell Formulas
RangeFormula
D3:D7D3=VLOOKUP(DATEDIF(B3,IF(C3="",TODAY(),C3),"m"),$F$3:$G$6,2,1)
Thank you very much, this is perfect.
 
Upvote 0

Forum statistics

Threads
1,215,530
Messages
6,125,350
Members
449,220
Latest member
Edwin_SVRZ

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top