Material requirements planning (MRP) integrates the planning of production, scheduling, and inventory activities in a manufacturing process. Many approaches to MRP management focus either on the simulation of the system (without considering optimization aspects) or in its optimization (without considering stochastic aspects). This paper analyzes a MRP version in which the demand of final products in each period is a random variable. The goal is then to find the optimal safety-stock configuration of both the product and the parts, i.e.: the configuration that minimizes the expected total cost. This total cost is given by: (i) the inventory cost; and (ii) a penalty cost generated by the occurrence of stock outs. To solve this stochastic optimization problem, a spreadsheet simulation model is proposed and a heuristic procedure is employed over it. A numerical example illustrates the main concepts of the proposed approach as well as its potential.