How to scale analog input values?

Input voltage 0 to 5 volts at an analog pin gives value read at the pin of 0 to 1023. But in my application only 50 to 800 is useful.

I would like 0 volts to equate to 50 and 5 volts equate to 800 with linear scale between those values. How can I do this?

Cheers.

Use the map function:

MyValue = map(analogRead(MyPin), 0, 1023, 50, 800);

Thank you MorganS! Works like a charm!

Cheers.