**Abstract**

One of the most important aspects of the livestock sector is ration cost optimization, which results in profit and ideal animal health. Manually preparing rations is time consuming and unsafe. Whereas computers can quickly formulate a ration that meets all of the nutritional requirements, after giving standard data on feeds. However, the existence of the ideal computer programme is questionable; if it exists, it is more expensive, less user-friendly, exclude local feeds, be limited to a particular region/country, feed composition may differ. As a result, in this chapter, the user will learn how to create and develop a self-made least-cost ration formulation using the locally available feeds, so that user may easily build their computer Programme using Visual Basic application of Microsoft Excel. There are three phases to ration formulation for any animal (ruminant or non-ruminant). The first phase requires the user to know the available feeds and their nutrient composition. The second part involves determining which nutrients are important for animals and creating nutrient equations. The third phase involves the creation of a linear programming model. Finally, the interface is being designed. Each phase is thoroughly explained in excel, with suitable data and reference coding.

**Keywords:** least cost ration, linear model, nonlinear model, visual basic application, nutrient requirements
