Situation: A Gnome Bard sits in a prison cell, next to her in another cell sits a half-elf Ranger. There is one guard with them in the room, with two or three more in the next room. The Bard casts Sleep at a point that includes everyone but her.
My understanding of what happens: Half-elves are not immune to the spell Sleep, as the spell ignores only unconscious, undead, and immune-to-being-charmed creatures, of which half-elves are neither. Therefore, if the half-elf has sufficiently low hp to be affected, his current hp is deducted from the spell's remaining roll total before moving to the next target, but he does not fall asleep due to Fey Ancestry. This means that including any targets with Fey Ancestry in the area of a Sleep spell is just a waste of the spell's potential.
Question: Is my understanding of the situation correct? I'm not as much asking whether or not the half-elf should be affected, as I'm quite sure he should be, but more whether or not his hp would be deducted from the spell's roll.
Relevant PH fragments: (emphasis mine)
Fey Ancestry. You have advantage on saving throws against being charmed, and magic can't put you to sleep. (PH p.39)
Sleep (…) Creatures within 20 feet of a point you choose within range are affected in ascending order of their current hit points (ignoring unconscious creatures). Starting with the creature that has the lowest current hit points,(…) Subtract each creature’s hit points from the total before moving on to the creature with the next lowest hit points. A creature’s hit points must be equal to or less than the remaining total for that creature
to be affected. Undead and creatures immune to being charmed aren’t affected by this spell. (PH p.276)
You have it exactly correct. A (half-)elf in the area of the spell is affected in ascending HP order and sucks up the appropriate amount of the 'payload', it's just going to have no effect, and represents a waste of some of the spell's output.