I thought that first solution from Marie was fairly brilliant. Never would have thought of that all day myself.

]]>some lines can be reduced, but I left them in for readability's sake

numberofyears can be calculated (to cover the second question, startyear can be calculated to cover the first question

list:="0":"1":"2":"3":"4":"5":"6":"7":"8":"9";

fulllist:=list*+list*+list;

numberofyears:=16;

startyear:=1999;

shortlist:=@Subset(fulllist;numberofyears);

yearlist:=startyear+@TextToNumber(shortlist);

@Text(yearlist)

]]>bounds := @sort(@year(MYREFFIELD):@year(@now));

len := bounds[2]-bounds[1];

range:=0;

@for(i:=1;i<=len;i:=i+1;range:=range:i);

bounds[1]*+range

]]>List:=0:10:20:30:40:50:60:70:80:90*+0:1:2:3:4:5:6:7:8:9;

Start:=1999;

End:=@Year(@Today);

Offset:=End-Start+1;

@Subset(@Text(Start+List);Offset)

]]>min := @year(MYREFFIELD);

len := @year(@now)-min;

range:=0;

@for(i:=1;i<=len;i:=i+1;range:=range:i);

min*+range

]]>range := @getprofilefield("basics"; "numrange");

min := @year(MYREFFIELD);

list := min*+range;

@Subset(@Text(list);@Year(@Now)-min+1)

]]>StartYear := 1987;

@For(n := @Integer(StartYear);

n <= @Year(@Now);

n := n + 1;

years := years:@Text(n));

@Trim(years)

]]>Start:=1899;

End:=@Year(@Today);

@For(n:=Start;n<=End;n:=n+1;List:=List:@Text(n));

List

For your first problem I came up with almost exactly the same solution as Marie, but she was quicker :-)

]]>In this case the start year varies for each document and is stored in a date field on it. The end date of the range is always the current date. So if the document's stored date was 2002 the computed list would be 2002, 2003, 2004, 2005, 2006.

]]>Marie's solution is perfect and demonstrates the original point I was making about the Formula language.

It seems perverse though. I can see how it works but I would never have arrived at that solution myself.

Am I right in saying that these tricks are non-intuituve and simply a case of remembering how? Or am I being stupid?

Ok, another problem. Take any year in the past and give me a list of the years between now and then. Say the year was 1999. I want 2006, 2005, ..... 2000, 1999. The 1999 here is the variable. Can Marie's solution be adapted to allow a variable number of years to be added to the list?

]]>min := @Year(@Now)-5;

min*+0:1:2:3:4:5:6:7:8:9:10:11:12:13:14:15;

]]>this should do the trick:

@Unique(@Text(@Year(@TextToTime(@Explode(@TextToTime( @Text(@Adjust(@Now;-5;0;0;0;0;0)) + " - " + @Text(@Adjust(@Now;10;0;0;0;0;0))))))))

Greetings

Peter

]]>