There are a few formulas and concepts you can use to estimate this value if you're willing to assume constant and known inerest rates.
For instance, we can use the all purpose formula PV = R/SWR to find the estimated value of your total expenses in retirement and the estimated value of your pension. Then we simply discount the value of the pension for the number of years between retirement and when you qualify for the pension and subtract that amount from the value of your expenses, and voila we have an estimated amount needed to retire. There is some complication with whether or not the pension is inflation adjusted and whether the amount of the pension increases over time, but I'll work examples below starting with the simplest case and working to more complicated cases.
We will start with my basic assumptions. Let's assume that I am a 52-year-old worker with a $325,000 investment portfolio and investment contributions of $50,000 per year with estimated expenses in retirement of $30,000 per year. I have a pension that is inflation adjusted and will be $10,000 per year (in today's prices) starting when I am 67, no mattter how much longer I work. My safe withdrawal rate is 4%. I assume that my investments will return an inflation adjusted 7% per year.
When will I be able to retire under these assumptions? First I need to price my expenses. Using basic back-of-the-napkin formula mentioned above, my expenses are valued at $30,000/.04 = $750,000. Likewise, my pension will be worth $10,000/.04 = $250,000 when I reach age 67. Since the pension is inflation adjusted both from now until age 67 and after age 67, I need to discount the value of my pension for the number of years between retirement and age 67 using my SWR. Let my age at retirement be called n. At retirement my pension will be worth $250,000 * (1 - .04)^(67 - n). My investment portfolio, on the other hand, will be worth $325,000 * 1.07^(n - 52) + $50,000 * (1.07^(n - 52) - 1)/.07. Now I simply need to find a value of n for which the value of my pension plus my portfolio value equals $750,000. For n = 52, the pension is worth $135,521.60 while my portfolio value is $377,750 for a total value of $513,271.60 which is short of the $750,000 needed to retire. If n = 55, then the pension is worth $153,177.40 while my portfolio value is $559,207 for a total value of $712,384.40. n = 56 results in a total value of $787,911.30, so I estimate my retirement date to be some time between age 55 and age 56.
What if we assume that my pension will be inflation adjusted after retirement, but I will only receive a nominal $10,000 per year at age 67?
In this case, the only factor that has changed is the value of my pension. Since the pension will still be inflation adjusted past age 67, the value of the pension at age 67 remains unchanged at $250,000. However, instead of discounting this amount at my SWR, I need to discount at an inflation adjusted rate. I will assume an effective inflation rate of 2.5% per year. The discounted value of my pension at retirement is consequently $250,000 * ((1 - .04)/(1 + .025))^(67 - n). If I plug in age 56 as above, I get a total value of $746,743.80, just short of my $750,000 goal. So I estimate that I will need to work to some time around age 56 under these new assumptions.
What if we assume that my pension will be a nominal $10,000 per year if I retire this year, but it will increase by a nominal $1,000 per year per year that I continue to work from now until age 67 at which point it will be inflation adjusted only?
Again, the only value that has changed is the value of my pension. However, this time that change is to the value of the pension at age 67. Instead of $250,000, the value of my pension at age 67 will be ($10,000 + $1,000 * (n - 51))/.04. Plugging this into my formula for the discounted value of my pension at retirement will be ($10,000 + $1,000 * (n - 51)) / .04 * ((1 - .04)/(1 + .025))^(67 - n). Now the total value at n = 56 is $805,939.90, overshooting my $750,000 goal. I can again estimate that I will retire between ages 55 and 56.
Finally, what if my pension, while retaining most of the charactaristics of the last example, is not inflation adjusted past age 67?
In this case, we must add in the inflation factor to the value of the pension at age 67 giving us a value of only ($10,000 + $1,000 * (n - 51))/(1 - (1-.04)/(1+.025)). The value of my pension at retirement is then ($10,000 + $1,000 * (n - 51)) / (1 - (1-.04)/(1+.025)) * ((1 - .04)/(1 + .025))^(67 - n). The total value at n = 56 is now only $740,368.80. I estimate that I can retire some time between ages 56 and 57.
I think that covers a sufficient number of cases and concepts that you can tease out the right formula for your specific situation. Note that if the pension is very far away, then it will probably be next to worthless in these formulas. Also, the above are mere estimates; the real stock market does return a constant, real 7%.