I am a bit confused about a test that I did in Excel. If anyone has an explanation please let me know it!

I have two sheets. one sheet is data ( named as data) and the other is calculation ( named as calc).

If in a cell of 'calc' sheet I write the below code I will get #Value! when I use evaluate formula (But excel shows the correct answer) when it reach of calculation of Data!$A$1:$A$12. This happens if and only if I use indirect with the reference to the other sheet.

=SUM(IF(INDIRECT("'Data'!$A$4"):INDIRECT("'Data'!$A$12")="a";1;0))

Thank you for your support!