How can I make a simple voltage-controlled attenuator?
You want to measure dc voltages up to say 15 volts and these might have 2 volts of ripple superimposed for a half guess. Your smallest dc voltage might be 3v and you think your measurement accuracy may be unduly affected at the low end, yes?

Don't worry about it - make your input suitable for top peaks of 20 volts and you'll find that with a ten bit ADC you'll be just fine. Ten bits means a resolution of 20 ish milli volts and with a smidgen of noise superimposed and several samples averaged you'll easily achieve decent accuracy. Taking two samples then averaging gives you an 11 bit number and this will be accurate to 11 bits with out of band ac noise on top.

Try looking up dithering - it's a well formulated technique that improves the resolution of 16 bit CD audio so that it sounds less grainy to the ear on quiet passages of music. You just need a little bit of out of band noise to make it work.