I'm trying to build a sheet that takes the odometer number from a car, and tells how many miles are left until each maintenance operation.
To do this, I think I need to take the odometer value (henceforth x), and subtract the repair interval from it, (for example, 7500 mi, henceforth y) and either have it stop subtracting at the last iteration before the number hits 0, or have the function add y back to it once and stop, displaying the final value.
So, mathematically,

Iterate (x-y)=z through (z-y) until (z-y)<0, then either take the last positive value of z, or add y back to the first negative value of z so that [(z+y)=h], h>0.

Any ideas?