This morning we were lucky to see this in the sky up above our school.
It is not a rainbow at all but called a circumzenithal and occurs when light bends through ice crystals being held in a cloud (rather than light bending through a raindrop). It creates an upward smile (rather than a frown) because the ice crystals are hexagonally shaped unlike the raindrop. The sun also needs to be within a limited range above the horizon to create it in order for the sunlight to refract through these ice crystals in the correct way, separating the colours.
(Many thanks to Mrs Mulcahy for her research and information)