When my Refinery finishes in the heat of battle, I don't have time to manually find 3 workers that aren't holding any minerals.
What is the optimal way to transfer 3 workers from minerals to gas without sacrificing any minerals?
The most efficient way is to select any 3 workers, right click on the gas, then immediately hit C (return cargo). Workers that are holding minerals will drop off their minerals, and then proceed to gas. Meanwhile, workers without minerals will head straight for the gas!
It depends on what you mean by "not lose minerals"
If you do it manually, you'll take about 2 seconds, and you can lose zero minerals.
If you don't do it manually, statistically, you'll have one who is walking to gather (A), one who is walking back with minerals in hand (B), and one who is in the middle of gathering (C). (As they spend about a third of their time on each task)
If you're in the middle of the battle and need the absolute most amount of time you just have them all start going to the gas:
Option 2: If you have a brief instant of reprieve, but need to get back on the battlefield, you can save 5 minerals from option 1, by sending (B) back to the base. The quickest way to do that is by ordering "return with goods". This is better then sending them all back to the base, because only the one with minerals will run back. Immediately after issuing the "return with goods / return cargo" command, shift right click on the geyser, and that will queue a command to the geyser, which for the other two will be executed instantly. This can be done in one instant, because the return with goods command can be issued by the keyboard hand, while the mouse hand will be moving to issue the command to the geyser.
Option 3: If you have a little bit longer, select only those that are going back to mining, that way you lose no minerals at all, nor even time wasted mining.
It does depend on how urgent you need to get back to the battle, but if the battle is so important that it can't be delayed by a couple seconds, the gas can probably wait.
What I usually do is quickly grab the group that is nearest to the gas, shift click the excess workers then shift click my 3 to the Nexus/Command Center/Hatchery then shift click to the gas. This will tell them to drop off any minerals they have (no wasting) and then go mine gas.
shift + click = queueing commands. So you are telling the worker to finish mining -> drop off minerals -> mine gas
Usually, when your gas is depleted, naturally, you would have idle workers.
Here is what I do: On top of Mark's answer, if you have idle workers then you can press
F1 to select an idle worker. However, if you hold
F1 then it will select ALL idle workers. So assuming you do not have any other idle workers, and when your gas is depleted then you can just press
F1 and select the 3 idle workers.
The easiest manual way to do it would be to just select three workers and get
Ctrl+1-9 them. This will then bind them to a key. Quickly click on the nearest base to the workers, this will allow them to drop any minerals that they are carrying. If your battling and cant watch them, when you see the "Workers not working" button appear on the left hand side of your screen press
1-9 depending on what HotKey you selected and then click on your refinery. This would result in no loss in minerals, via them being dropped.
I usually just draw a small rectangle close to the command center/hatch/nexus and keep the mouse button down until there are at least workers 3 in it. Then i quickly right-click on the cc/hatch/nexus in case they carried anything and then i send them to the refinery. If i got more than 3 (usually i don't, but sometimes i get a fourth worker) then after sending all to the refinery i pick the excess workers in the selected units list and send them to work on the minerals again. This takes roughly 1-3 seconds, depending on how many workers you have and how good you are at figuring out where the 3 workers will be easiest to capture.
It's easier and faster to rectangle-select more and remove the unnecessary ones than it's to select them one-by-one when they are moving.