How to calculate standard deviation within/between

#1
Hi,

I saw the standard deviation calculation using within/between option in minitab tool,but I need to know the logic or fomula to drive it. I have to implement the same logic somewhere. Can any one explain this with data.

Thanks