Years into groups

zinah

Active Member
Joined
Nov 28, 2018
Messages
368
Office Version
  1. 365
Platform
  1. Windows
Hi!

I have column which has several termination dates and what I need to do is to group those dates into years as showing below:

- Less than 1 year
- 1 year
- 2-3 year
- More than 3 years

What is the best formula to use?


Thanks!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try:
Excel Formula:
=IF(E2-TODAY()>=1095,"More than 3 years",IF(E2-TODAY()>=730,"2-3 year",IF(E2-TODAY()>=365,"1 year","Less than 1 year")))
Put this formula in a new column, change E2 to your date column accordingly. Now you can filter on this new column.
 
Upvote 0
Try:
Excel Formula:
=IF(E2-TODAY()>=1095,"More than 3 years",IF(E2-TODAY()>=730,"2-3 year",IF(E2-TODAY()>=365,"1 year","Less than 1 year")))
Put this formula in a new column, change E2 to your date column accordingly. Now you can filter on this new column.
Thank you for your quick response!
I tried your formula after adding another condition which was: if the cell is empty, then keep it empty and all the results were "Less than 1 year" + empty
Not sure why this happened, any thoughts or suggested amendment to the formula?

Formula:
Excel Formula:
=IF(CM15="","",IF(CM15-TODAY()>=1095,"More than 3 years",IF(CM15-TODAY()>=730,"2-3 year",IF(CM15-TODAY()>=365,"1 year","Less than 1 year"))))


DateFormula
1/1/2021​
Less than 1 year​
10/1/2019​
Less than 1 year​
4/1/2020​
Less than 1 year​
11/1/2019​
Less than 1 year​
4/1/2020​
Less than 1 year​
4/1/2019​
Less than 1 year​
 
Upvote 0
With that date you don't have any dates that are 1 year or greater.
+Fluff v2.xlsm
CD
14DateFormula
1501/01/2021Less than 1 year
1610/01/2019Less than 1 year
1704/01/2022Less than 1 year
1811/01/20231 year
1904/01/20242-3 year
2004/01/2025More than 3 years
Sheet2
Cell Formulas
RangeFormula
D15:D20D15=IF(C15="","",IF(C15-TODAY()>=1095,"More than 3 years",IF(C15-TODAY()>=730,"2-3 year",IF(C15-TODAY()>=365,"1 year","Less than 1 year"))))
 
Upvote 0
With that date you don't have any dates that are 1 year or greater.
+Fluff v2.xlsm
CD
14DateFormula
1501/01/2021Less than 1 year
1610/01/2019Less than 1 year
1704/01/2022Less than 1 year
1811/01/20231 year
1904/01/20242-3 year
2004/01/2025More than 3 years
Sheet2
Cell Formulas
RangeFormula
D15:D20D15=IF(C15="","",IF(C15-TODAY()>=1095,"More than 3 years",IF(C15-TODAY()>=730,"2-3 year",IF(C15-TODAY()>=365,"1 year","Less than 1 year"))))
Thank you for your usual help! I know why the formula is not working as I expected, it's because I was not clear in my question. What I want is to set the dates according to past not future:

- Less than 1 year: is any day that's less than 1 year i.e. Jan 5, 2021
- 1 year: is any day that passed 1 year i.e. Jan 15, 2020
- 2 to 3 year: any day that passed 2 to 3 year (during 2019 & 2018
 
Upvote 0
Upvote 0
Solution
How about
+Fluff v2.xlsm
CD
14DateFormula
1515/01/2021Less than 1 year
1615/01/2020Less than 1 year
1715/01/20191 year
1815/01/20182-3 Years
1915/01/2017More than 3 years
2015/01/2016More than 3 years
Sheet2
Cell Formulas
RangeFormula
D15:D20D15=IF(C15="","",IF(EDATE(C15,12*3)<TODAY(),"More than 3 years",IF(EDATE(C15,12*2)<TODAY(),"2-3 Years",IF(EDATE(C15,12)<TODAY(),"1 year","Less than 1 year"))))
Amazing! that worked perfectly great. Only one hiccup, dates from Feb 2019 to Dec 2019 were labeled under 1 year, so I changed the text to 1 year and less than 2 year to reflect. Unless if you have a solution for that? which I'm fine either way.

Thank you once again!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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