Q. I own a lunch truck where I sell pre-made sandwiches. My problem is that if I make too many sandwiches, it costs me money because I have to throw them out. On the other hand, if I don’t make enough sandwiches, I lose sales because I run out of product to sell. Can you help me think about how many sandwiches I should make each day?

A. This is a classic cost of overage vs. cost of underage problem. The first step is to estimate the number of sandwiches you will sell each day. If you have historic information about the number of sandwiches you have sold, this will be useful. If not, use your best estimate, but collect data going forward.

The simplest approach is to divide the total number of sandwiches you sold over the past year on days when you didn’t run out by the number of days that you didn’t run out of product. This will give you an estimate of the number of sandwiches you sell daily. Consider only days when you didn’t run out, because on days when you ran out, you don’t actually know how many sandwiches you might have sold if you had them.

Once you have the simple point forecast described above, you may want to consider additional factors such as:

Trends – If your business is growing, you will want to forecast sales that are above the average for the past year. Similarly, if sales are declining, you will need to forecast below the average for the past year.

Seasonality – You might find that you sell more sandwiches when children are in school, because fewer people are on vacation.

Day of the week – It may be that you sell fewer sandwiches on Fridays than on other days, because people are taking long weekends.

Weather – The number of sandwiches people purchase might change with temperature and/or precipitation.

There are quantitative techniques that can help with demand forecasting, but applying good business judgment will always be important. Once you understand the impact of factors such as the ones described above, you can adjust the current day’s forecast up or down, as appropriate. The result will be your best estimate of the number of sandwiches you will sell on any given day.

The cost of overage (the cost of having to throw out a sandwich) is the money you spent to make each sandwich. The cost of underage (the cost of a lost sale) is the profit you lose when you miss a sale because you ran out of product. Note that the cost of underage will always be the price minus the cost of overage.

We’ll make the assumption that the actual demand for your sandwiches is equally likely to be above or below your point estimate. In this case, if the cost of overage is equal to the cost of underage, you should simply make the number of sandwiches equal to your point estimate.

If the cost of overage is greater than the cost of underage, you’ll want to make fewer sandwiches than your point estimate. On the other hand, if the cost of overage is less than the cost of underage, you’ll want to make more sandwiches than your point estimate. This makes sense because you want to avoid the more costly consequence.

You can use the formula below to optimize the quantity of sandwiches you make. Admittedly, this is somewhat of an oversimplification, but if we attempted to be more precise, the math gets very complex.

Optimal Number = Point Estimate X (1 – ((cost of overage – cost of underage) / sandwich price))

Therefore, if the Point Estimate is 426 sandwiches, the cost of overage is $1.00, the cost of underage is $3.50, and a sandwich sells for $4.50, the optimal number of sandwiches to make would be 663.

Admittedly, most of the time you will be throwing sandwiches out, but that will only cost you $1.00 per sandwich. Each unit of lost sales because you ran out would cost you 3.5 times that much. Therefore, it makes sense that you would want to have a few extra sandwiches on board.

Finally, in making a decision about how many sandwiches to make, you may want to consider longer term implications. For example, regularly running out of sandwiches may drive customers away. You will want to use good business judgment when adjusting quantities based on such factors. As is nearly always the case, analysis can help you understand the situation, but almost every business decision has an element of judgment.