When is it ok to sand against the grain?
Sanding with or against the grain doesn't matter much until the last sanding stage, if that. Lots of us use random-orbit sanders which sand in all directions at once, and that works Just Fine.

The first sanding pass, with the coarsest grit sandpaper, does most of the work of levelling the surface; ideally, it should leave you with no scratches larger than that grain. Each successive move to finer sandpaper erases the previous set of scratches and creates finer ones -- and shouldn't take as long since there isn't a lot you need to remove in order to do that. The final sanding, with the finest grit sandpaper you're going to use, should be with the grain so any remaining scratches also line up with the grain and hence are less noticeable.

Ideally. I have to admit that I've been known to just random-orbit my way through and trust that the 220 sandpaper's scratches are fine enough not to be noticed after the wood has been coated with varnish. I'd probably be more paranoid if I was staining the wood, since sanding details can affect how the stain is picked up... or if I was doing something that will be looked at from inches away rather than feet.