סימן עו סעיף כג
אִם טָעָה בִּתְפִלַּת יוֹם טוֹב שֶׁהָיָה לוֹ לַחְתּוֹם מְקַדֵּשׁ יִשְֹרָאֵל וְהַזְּמַנִּים, וְחָתַם מְקַדֵּשׁ הַשַׁבָּת, אִם חָזַר בְּתוֹךְ כְּדֵי דִּבּוּר וְאָמַר מְקַדֵּשׁ יִשְֹרָאֵל וְהַזְּמַנִּים, יָצָא. וְאִם לָאו, צָרִיךְ לַחֲזוֹר וּלְהַתְחִיל אַתָּה בְחַרְתָּנוּ וְכוּ' (תפ"ז).
If you erred in the Yom Tov prayers, and instead of concluding Mekadeish Yisroel vehazemanim, [Sanctifier of Israel and the Seasons,] you concluded with Mekadeish Hashabbos, [Sanctifier of the Shabbos,] if you retracted within the time of kedei dibbur59The time it takes to say שָׁלוֹם עָלֶיךָ רֶבִּי which is three words. [Most acharonim and Mishnah Berurah 487: 4. The Peri Megadim says four words (שָׁלוֹם עָלֶיךָ רֶבִּי וּמוֹרִי). and said Mekadeish Yisroel vehazemanim, you fulfilled (your obligation). And if not,60If you started Retzei you still have this allotted time to correct yourself [Peri Megadim]. However, Biur Halachah 487 disagrees. you must go back and start (again) from attah vechartanu.
תנא דבי אליהו כל השונה הלכות בכל יום מובטח לו שהוא בן העולם הבא שנאמר הליכות עולם לו אל תקרי הליכות אלא הלכות (נדה ע"ג.)