Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to find the easiest way to group employees based on tenure. I have everyones start date and I was going to get the number of days that they have been employed by taking the current day minus the start date. I then want to join my list to the table below which would give me their tenure group.
Any assistance would be great. Thank you.
.
TenureGrp | MinDays | MaxDays |
---|---|---|
0 to 2 Months | 0 | 59 |
2 to 4 Months | 60 | 119 |
4 to 6 Months | 120 | 179 |
6 to 8 Months | 180 | 239 |
8 to 10 Months | 240 | 299 |
10 to 12 Months | 300 | 360 |
Over 12 Months | 361 | 1000000 |
You can use the intervalmatch function. See the attached example for a demonstration of this function.
you can use the class function ,
attach is an example
Gysbert - thank you for the usefule info.
Liron - Thank you for the example as well. I have never used the class function before. This actually worked out perfect. It also gave me a million ideas on how to use it on other projects.
thanks to all for you assistance.
Personally, I prefer the intervalmatch in cases as these. You have more flexibility with the names of the ranges and you aren't limited to the fixed interval width of the class function. For months >12 you need an extra if statement to group all classes over 12 months together.
Gysbert - Crazy that you just replied. I just tried to integrate the class method and I ran into just that issue. Thank you for pointing that out.