Formula - Omit values until new month begins

I'm looking to omit existing values until a new month begins.

Currently YTD Plan =Sum(H4:Q4) I'm summing values from Jan through Oct. When the new month begins (November) is there a formula or function that will update T4 automatically? The values are already there so just need to omit or not include R4 and S4 until those months begin. Is there a way or function to accomplish this so that I won't have to modify or extend the formula every time a new month begins? Thank you

Updated Picture from recent comment - 11/4

enter image description here


Check if this works for you. Sample data as in below screenshot.

enter image description here

Formula in P4 is

=SUM(INDEX(D4:O4,1):INDEX(D4:O4,MONTH(NOW())))

However even if the calculation is set to automatic, you need to open the sheet or at least update it to get the update to the formula. So if month changes from Oct to Nov, you should either press F9 or edit the data or re-open the sheet for the formula to update.

Edit - Based on more inputs in Comments

See the below screenshot and the recorded screen.

enter image description here

enter image description here

In Q2 Data Validation List is added with Values as Planned, Actual.

Formula in P4 is

=IF(Q2="Planned",SUM(INDEX(D4:O4,1):INDEX(D4:O4,MONTH(NOW()))),SUM(IF(ISNUMBER(D5:O5),D4:O4,0)))

This is an Array Formula, so you need to press CTRL + SHIFT + ENTER from within the Formula Bar to create this Array Formula. The formula shall be automatically enclosed in Curly Braces to indicate that it's an array formula. This step is important, else it will not work correctly.

Now based one the Selection from Drop Down

If Planned is selected, the SUM of Planned up to the actual Current Month is reflected in Planned YTD.

If Actual is selected then SUM of all Planned values for which corresponding Actual values exist is reflected in Planned YTD.