I know I can find basic preflop ranges online for when you are the first to open. I also know you are meant to play tighter to opens before you. How specifically do you adjust? For example if you are on the button and have a raise in the cutoff and under the gun? I want a way to calculate what percentage of hands I should play.
There are two options when facing a raise, you can either flat or 3-bet.
When you 3-bet
Usually you want to 3-bet roughly 1/3 of opening range in frequency. So if you 3-bet the CO, since the position opens 25% you should 3-bet roughly 8%. The reason for this is that he will call a bit less than half the time and you want to be ahead of his calling range when you 3-bet for value (the case when you 3-bet 1/4 ~ 1/5 of his opening range, half his calling range) and not have too many bluffs (1/3 of your total range).
When you flat
This is a bit trickier to answer because it will depend, as well as how tight is open raiser, how deep stacks are, if you have the position or if you're on blinds, and whether or not people came into the pot before you flat. General guidelines are the following :
Flat first as little as possible when people play behind you; never can be an option, although probably defensive, but preferable to the option of flatting too much in this situation, because 1- you might get squeezed or overcalled with little counterplay possible, 2- you will play a raked pot (cash game consideration; but in tourney, ICM applies), 3- if you're not strong enough to 3-bet then flatting is thin ev anyway, this will at best marginally compensate 1 and 2.
Overcalling is good with hands that don't hit often but hit hard e.g. pocket pairs and suited connectors, suited aces, if the stack depth is good enough.
On the BB, you can flat quite wide in contrast, because you are closing the action preflop, and because you are offered good odds. How large is dependent of how loose is the raiser and how big is the raise, but on a 2.5x from button you are supposed to call around 40% of hands for defense; on a 3x, closer to 30% (this comes from ev simulations of solvers and minimum defense frequency calculations).