How to have my laptop go to sleep when unplugged while lid shut? (Don't want it to go to sleep when closing lid and plugged in)

As you see here, all you need to do is

  1. Go to Control Panel
  2. Click on Hardware & Sound
  3. Click on Power Options
  4. Click on Choose when to turn off the display of Change when the computer sleeps
  5. Follow the Given Directions

You have to dig into the power setting a bit to find this:

  1. Click start, then type “edit power plan”, click “edit power plan”
  2. Click “change advanced power settings”
  3. Expand “power buttons and lid”
  4. Expand “lid close action”
  5. Here you have two options for what happens when you close the lid, "on battery" and "plugged in" - set the "on battery" option to sleep

That will give you the desired effect.