Correct where the Future Value is not fixed. Often it is known or guessed in advance: $0, or age care capital or bequest.
There is a more complicated formula for the calculation you describe but it is not implemented as a single function in spreadsheets. Hence need for 'schedule' / table.
The alternative is to calculate using real rates and values only. I did not make clear in the OP that the part before '*' calculates the real rate using real capital values, the part after converts the real to nominal:
= (1 + RATE((AgeDie-AgeRetire), AnnualWithdrawal, -CapitalRetire, 0, 0)) * ( 1 + Inflation%) - 1
The real rate is:
= (1 + NominalRate) / (1 + InflationRate) - 1
[To make clear: AnnualWithdrawal would be a constant. $40k (real) every year to use your example.]