Praise be to Allah.
Firstly:
It is not valid to change the intention of observing the
voluntary fast that one has completed in order to make it a fast to make up
for a day of Ramadan which one did not fast, because when making up missed
fasts, it is essential to form the intention the night before, because
making up missed fasts comes under the same ruling as the original fast. The
Prophet (blessings and peace of Allah be upon him) said: “Whoever does not
intend to fast before dawn, his fast does not count.” Narrated by
at-Tirmidhi, 730; classed as saheeh by al-Albaani in Saheeh at-Tirmidhi.
At-Tirmidhi said after quoting it: What is meant, according to the scholars,
is that the fast does not count for the one who did not form the intention
to fast before dawn broke in Ramadan or when making up a missed Ramadan fast
or when fasting in fulfilment of a vow. If he did not form the intention to
fast from the night before, then it does not count. As for voluntary fasts,
it is permissible for him to form the intention after dawn breaks. This is
the view of ash-Shaafa‘i, Ahmad and Ishaaq. End quote.
an-Nawawi (may Allah have mercy on him) said:
A Ramadan fast or making up a fast or an expiatory fast or a
fast offered as fidyat al-Hajj (compensation for mistakes in Hajj) or other
obligatory fasts are not valid if the intention is made during the day.
There is no difference of opinion on this matter.
End quote from al-Majmoo‘, 6/289
See: al-Mughni by Ibn Qudaamah, 3/26
That is because changing the intention after finishing an act
of worship does not have any impact.
As-Suyooti (may Allah have mercy on him) said in
al-Ashbaah wa’n-Nazaa’ir, p. 37:
If a person intends to end his prayer after completing it,
that does not render it invalid, according to scholarly consensus. The same
applies to all other acts of worship. End quote.
So the fast that was done with the intention of observing a
voluntary fast cannot count as a fast observed to make up for (a missed
obligatory fast).
And because if he started observing it as a voluntary fast,
then he decided during the day to change it into a fast observed to make up
for (a missed obligatory fast), then he would have fasted part of that
obligatory day on the basis that it was voluntary, so it cannot make up for
an obligatory fast, because actions are but by intentions, and he fasted
part of the day with the intention of it being voluntary.
And because he changed the intention from a general fast to a
specific fast, and that is not valid.
And Allah knows best.
For more information, see the answer to question no.
39689
But we should point out to you that observing naafil fasts is
not disallowed for the one who still has to make up Ramadan fasts, as
mentioned in the question. Rather the correct opinion is that if a person
wants to observe a voluntary fast when he owes an obligatory fast, such as
making up missed days from Ramadan and the like, his fast is valid so long
as he still has enough time to make up what he owes before the next Ramadan
begins. But what is not allowed is to fast the six days of Shawwaal before
making up what he owes from Ramadan. However this is a matter concerning
which the scholars differed.
See also the answer to questions no.
41901 and
39328.