it works in both storage and inventory, providing whichever you're using isn't full.
However I believe the OP wants (and i agree) that when you right click and split a stack, one part stays in the original location, and the other is held in your hand for placing wherever you want.
this would solve the problem of not being able to take a partial stack from a full container for instance.