You can animate the gradient in Ramp including the colors. Ramp only has 2 colors.
You can animate the gradient fill of a shape layer with as many colors as you can cram into the Edit Gradient Tool.
You can also animate the Colorama Input Phase Phase Shift. It's a lot easier than animating the Output Cycle. But, on the other hand, animating 20 or so color stops on the Edit Gradient tool wouldn't be any easier than animating 20 or so stops in Colorama.
You can animate the Master Hue in Hue and Saturation.
You can also animate all of the colors in 4Color Gradient.
That said, I'm exactly sure what you're trying to do. What colors are you trying to replace? The colors in a gradient or the colors in some video???
As Rick said, perhaps a little more info would help to nudge you in the right direction. Also what you describe sounds more like you need to spend some time on separating the color zones first to facilitate the process....