Realistic max amount of multiplexed inputs on ADC?

You work out the voltages at each switch position and set the thresholds half way between these voltages.
Put these thresholds in an array and use a while loop to go through the array starting at zero compairing your input voltage to the values. When an array position exceeds your input voltage the array position is your switch position.