I am not following your logic here. First, why can't you use a parameter? If you want the last three years, you could use a parameter value of 2007--or you could change the formula to use the ending year. And I meant for you to create formulas for the maximum number of years--if that is 7, then you have 7 sets of formulas.
If you are running this report against one database, then you would know the minimum and maximum year up front. Since you don't know this, it must be that you are running the report for different groups with varying date ranges or something. If you don't want to use a parameter, then you could create a SQL expressions for minimum year {%minyr} and maximum year like this:
(
select min(`year`)
from table B
where B.`ID` = table.`ID`
)
...where {table.ID} represents the field that distinguishes different groups--I don't know if these are accounts, or what, and where "table" represents your table name (A?) and "B" represents an alias table. The punctuation depends upon your database.
{%maxyr} would look similar:
(
select max(`year`)
from table B
where B.`ID` = table.`ID`
)
You could then use {%minyr} and {%maxyr} in the formulas and you would still be able to insert summaries.
-LB