Why complicate things? IFERROR is not needed
I think it would've been way easier to use the following function instead of the sophisticated IFERROR with EOMONTH:
The IF function above gives us the desired output so easily, right? Unless there is something else that I'm not being aware of which made you use that complicated function, which is why I'm asking you in the first place? Please guide me if I'm missing something in my IF function.
the IF function is needed for the cases where we input empty values, which is the case for some of the cells we fill. If you'd like you can try the formula without the IFERROR and see if it works for the whole exercise and let me know.