The max CP of a Pokemon depends on weight and height I think. In your example of the Rattata's with the 50% CP bar and a difference of 10 in CP, one Rattata is probably bigger.
If you evolve or power up the Pokemon it seems to go up with an x-percentage of the max CP of that level Pokemon. (Based on the fact that costs for powering up are same before and after evolution)
So if you evolve both, their CP level will probably show the same increase in percentages. I don't think it will be easy to figure out the exact formula. Since height and weigth seem to determine the max CP level. Not sure about this theory though, but that's what I make out of it after reading a lot and seen examples.
If your CP bar is full and maxed out for your Rattata, it will also be full and maxed out on your Raticate after evolving.
So basically if you want to reach the highest CP possible for a certain kind of Pokemon, you need to find the fattest one out there. And then you can evolve and power it up to the max