When is "Y" a vowel?
Solution 1:
The answer is that it depends on what purpose you have in assigning it, or what set of rules you are following.
From the point of view of phonetics, the first thing to realise is that letters are not vowels or consonants: they represent sounds which may be vowels or consonants (and in the case of "y" possibly both).
The next point is that bifurcation into vowels and consonants is too simple: phoneticians recognise other possibilities such as "semivowel" — which "y" often is.
It is clear that in "Yvonne" and "mystery" all the "y"s represent vowel sounds.
I would say that in "yacht" and "Yeltsin" they represent semivowels (which you can call consonants if you like.)
I would disagree strongly with decoz.com (quoted in Mehper's answer) about "Kay" and "Sydney" — I think it is preposterous to say that "y" is representing a consonant in those. In the case of "Sydney", it is part of a way of writing a simple vowel sound; in "Kay" it is part of a way of writing a long vowel sound or a diphthong, depending on dialect. (A diphthong consists of two vowels or a vowel and a semivowel depending on how you want to analyse it).
Solution 2:
The letter y represents the consonant /j/ (as in yes), known variously as a palatal glide, a palatal approximant and a palatal semi-vowel. It also represents the vowels /ɪ/ (as in hymn) or in some dialects /i:/ (as in trendy) and, alone or in combination, it represents the diphthongs /aɪ/ (as in try), /ɔɪ/ (as in boy) and /eɪ/ (as in day).
Solution 3:
Y can make 4 sounds:
a hard y, as in yield (in this case, it is a consonant, it's most common use)
a short i sound, as in bicycle
a long i sound, as in my
a long e sound, as in baby
In the last three cases it is used just as the letter i would be, and so it is a vowel.
It can also be used as part of a digraph, where two vowels written together are considered to have one sound. Examples would be ay in May and ey in Sydney. This is similar to the way other digraphs are used, such as ea in eager or ie in friend.