You have 1500/1000/1000 resources, with a growth of 200/h, but you need 20 archers because someone will attack you. For 20 archers you need 2400/0/1500 resources. So you can wait 4h30, fiddle with resources to gain a few minutes, or use the calculator above. It will tell you that you need to sell all your stones for wood and sell 386 units of wood for iron with an exchange rate of 1.25. After that, you have all you need and you've saved 4 hours and you'll win the next battle.
You can imagine a similar scenario with city walls.