Pokemon GO CP Formula

CP (Combat Points) is a derived number invented by Niantic to allow trainers to gauge the strength of a Pokemon.
I will just attempt to summarise it and not go in depth. Read the sources below for more advanced understanding.

CP is derived from the base stats and Individual Values (IV) of a Pokemon and dependent on its level.

The formula is as such:

CP = (BaseAtt + IndAtt) * (BaseDef + IndDef)^0.5 * (BaseSta + IndSta)^0.5 * (ECPM)^2 / 10

=> CP = TotalAtt * TotalDef^0.5 * TotalSta^0.5 * (ECPM^2)/10

Where ECPM (Effective CP Multiplier) is a constant for each Pokemon level.

CP is always rounded down to a whole number and the minimum CP is 10.

From the formula above, the Attack stat is weighted more heavily than Def and Sta which are both weighted equally in the CP calculation. 
Thus, any difference in level or IV will affect the CP value.