Hi, I'm stuck with this issue, please help!

I have a variable set of dates ranges, and I need to assign each range a number (or label or category) and avoid overlapped ranges in the same label.
So the numbers (or labels) will be the "Y-Series" for a timeline bar chart.

I need to get the minimum number of "labels" with no overlapped ragnges (3 in the case below) and put that numer to each date range.
So the fisrt range is ǵroup N1', if the start date of the second rage is bigger than the end date of the first, then it is assigned to group N1 too, otherwise, is the first range of group N° 2, and so on...

Explample of the set:

start date end date

04/2008 06/2008
04/2008 05/2008
07/2008 08/2018
07/2008 08/2008
09/2008 07/2014
08/2009 08/2009
08/2011 08/2011
12/2013 12/2013
02/2014 07/2014
09/2014 10/2014


I need a formula to put a numer as shown at yhe left of the start date:


1 04/2008 06/2008
2 04/2008 05/2008
1 07/2008 08/2018
2 07/2008 08/2008
2 09/2008 07/2014
3 08/2009 08/2009
3 08/2011 08/2011
3 12/2013 12/2013
3 02/2014 07/2014
2 09/2014 10/2014


Thanks!