Until recently I tended to think as Mark has said above and there is a lot of truth in it. However buying a guitar recently, we tried 2 guitars, same make/model/year. One really resonated well and sounded good acoustically, the other was a bit flatter and didn't resonate as much in the body. However, plugged in the flatter guitar sounded much much better, and projected sound better and has a better spectrum of sound.
So the caveat I'd add to Mark's post is don't discard a guitar before you've plugged it in. If it's made well and has at least a little mojo played unplugged then give it try through an amp.
Oh, and try the guitar on a good clean channel, if the guitar doesn't project a good sound clean, then it's missing some mojo.
My 2 pence anyway :)
I would probably still get the one with the better acoustic sound. If it sounds better acoustically, I'll eventually be able to get a better sound out of it electrically too..that's my philosophy.
Pickup height, AND the other electronics. Especially if it wasn’t a high end model, there are easily great differences in pot values, even though they are listed as same :/ 'Higher tolerances' :) Well, sadly you can see this in higher end models too..
About finding a good one, it was some video where Carl Verheyen suggested that you pick an open B-string while the guitar is hanging on the wall, and feel the bottom of the body to see if it resonates. If it doesn't, move away..that's one test, use it or not 8)
Then if it feels good and has a good acoustic sound, plug it in. I'll pretty much know by this point if the guitar is a keeper or not. Most of the guitars built today sound at least 'OK'. But I won't buy those. When you find a guitar that sort of 'speaks' to you, you'll know it :) I remember when I tried my McCarty for the first time in the shop. I must have played it for 45 minutes on the store. Not because I was trying to make up my mind whether it was good enough or not..I was just having too much fun. I knew the minute I plugged it in that I was gonna buy it.
-Zaned