With the tilde you concatenate two ranges from distinct sheets - first and last - to a new range. What you want, according to comments to the question, is to specify the full range of cells on all sheets - first to last. From-to range operator is colon.
This might have worked:
=COUNTIF('2010'.D:'2017'.D,"Yellow")
However, it doesn’t at this time. Sorry that I posted this as a solution, misleading you.
Many functions which operate on ranges do not support ranges across multiple sheets. One notable exception is SUM(). I do not know any other …
So, the workaround for your current data is to name each range explicitly, either by your approach of range concatenation, or mine with separate COUNTIF() for each range. Which one to use is up to you. Most likely there is little difference. I would guess that the former is marginally faster but I find the latter easier to read.
I do not know your exact layout, so for your case it may make sense, but subdividing source data to sheets by year this is usually a bad idea. It makes summaries much harder to create, and increases the potential for error.
Best practice is to have one large table for all data of the same type. Instead of creating a new sheet for a new year, add a field to indicate year for subdivision (if you already have a date field, year can be extracted from that). With that, it is easy to create the subdivisions as needed. You can have just one sheet, and enter the year to extract relevant data.