Could this be a use for the map() function to make this conversion easy to read?
map(value, fromLow, fromHigh, toLow, toHigh)
http://arduino.cc/en/Reference/Map
So for this 5v test case you could say something like
voltage = map(analogRead(Vin), 0, 1023, 0, 5);