If you just want to calculate the number of days in a month based on the year in cell C8 and the month in cell C6, I suggest you try this formula:

=DAY(EOMONTH(DATE(C4,C2,1),0))

enter image description here

Besides, if you want to select the corresponding data in the Data worksheet, I suggest you try this:

=COUNTIFS(Data!A5:A63,Test!C8,Data!C5:C63,Test!C6)

enter image description here

Data worksheet:
enter image description here


Update: Please check if the following is helpful to you.

enter image description here