Order of Making Up Missed Fasts
Question

I have missed fasts from three Ramadans, so I fasted the first and the second, then I learned that I was not required to make up for the first Ramadan, so are the days of the first Ramadan that I fasted sufficient for the days of the third Ramadan, knowing that I had the intention that they were for the first Ramadan?
Praise be to Allah.Firstly:
One who has days to make up from previous Ramadans should do so in order, beginning with the oldest. This sequence is mandatory according to the school of Imam Ahmad.
It is stated in "Kashshaf Al-Qina`" (2/308): "If one fasted the month of Sha`ban for three consecutive years, then realized that their fasting coincided with Sha`ban in all three years, they should fast three months, with the intention of making up the missed Ramadans; one month after another; that is, month by month; arranging them with the intention, just like the Salah if one missed it...; meaning, just as arranging the prayers is mandatory, so is arranging the Ramadans if missed." End quote.
However, the majority of scholars hold that such sequencing is not obligatory.
Ibn Al-Humam said in "Fath Al-Qadir" (2/112): "If one is required to make up two days from a single Ramadan, it is preferable to intend the first day they are obliged to make up from this Ramadan, and if they do not specify the first, it is permissible. Similarly, if they are from two different Ramadans, according to the preferred opinion, even if one simply intends to make up without specifying, it is permissible." End quote.
In "Minah Al-Jalil" (2/124), it is stated: "And whoever has to make up two Ramadans should begin with the first of them, and if they do the opposite, it suffices." End quote.
Al-Khatib Ash-Sharbini said in "Mughni Al-Muhtaj" (2/151): "If one has to make up two Ramadans and intends to fast tomorrow to make up for a Ramadan, it is valid, even if they do not specify which of the two Ramadans it is for; because it is all of the same category. Al-Qaffal said this in his Fatwas. He said: Similarly, if one has to fast a vow from different obligations and intends to fast the vow, it is valid, even if they do not specify the type, and the same applies to expiations as previously indicated, and Az-Zarkashi considered this an exception from the obligation to specify." End quote.
Secondly:
If you fasted with the intention of making up the first Ramadan, then it became clear that you have no make-up due, it is not valid to redirect what you fasted to the make-up of the third Ramadan; due to the saying of the Prophet (peace and blessings be upon him): "...and each person will be rewarded according to what he intended" narrated by Al-Bukhari (1), and Muslim (1907).
The intention was directed to the first Ramadan, and the third Ramadan was devoid of intention.
Changing the intention after performing the act of worship is not considered, as we explained in the answer to question number: (432428).
However, if you made up with a general intention, it would be valid to direct your make-up to the third Ramadan according to the aforementioned difference of opinion.
And Allah knows best.