Design and Development of Self-Made Cost-Effective Microsoft Excel Visual Basic Application for Livestock Ration Formulation

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.


Introduction
The primary goal of ration formulation in animal production is to offer a balanced diet that supports physiological functions such as growth, maintenance, reproduction, and lactation while also providing energy for physical and metabolic activity [1]. A standard and efficient feed formulation must include all the classes of feedstuffs (Animal Nutrition Group, India) [2] as provided in Figure 1.
A concentrate is a feed or feed mixture that provides increased levels of primary nutrients (protein, carbohydrates, and fat) while containing less than 18 percent crude fiber (CF) and low moisture. These are high in nitrogen-free extract (NFE) and Total Digestible Nutrients (TDN) and low in crude fiber [3]. There are classified into two categories: energy-rich concentrates and protein-rich concentrates, based on the content of crude protein (CP). When the crude protein content of dry concentrates is less than 18 percent, they are categorized as energy-rich concentrates, and when the CP value is greater than 18 percent, they are defined as protein-rich concentrates [4,5].
Roughages are heavy foods that contain substantially less digestible material, such as crude fiber greater than 18% and a low TDN content (about 60%) on a dry basis. Roughages differ in the level of protein, mineral, and vitamin composition. Some roughages, particularly legumes, are good suppliers of calcium and magnesium [6]. The phosphorus concentration is likely to be moderate to low, whereas the potassium content is likely to be high, these concentrations are affected by the plant species, soil, and fertilization strategies all have an impact on trace minerals. Roughages are categorized into two classes based on moisture content: dry and green or succulent roughages [7]. Green roughages often have 60-90 percent moisture, while dry roughages have just 10-15 percent moisture. Green roughages are divided into several types for ease of use, including pasture, produced fodder crops, tree leaves, and roots. Based on the nutritional content and preparation methods, dry roughages have been further categorized as hay and straw [8]. Minerals available in the feeds are of different types i.e., Micro minerals, macro minerals and chelated minerals. Microminerals, also known as trace minerals, are needed in milligrams (mg) or microgram (g) quantities [9]. They're found in trace amounts in animal tissues and feeds. They're frequently found in enzyme cofactors and hormones. Cobalt, iodine, zinc, copper, manganese, and selenium are examples of micro or trace minerals. Macro-minerals play a specific role in the formation and function of the animal's body. Animals require the following seven macro-minerals: calcium (Ca), phosphorus (P), sodium (Na), magnesium (Mg), potassium (K), sulfur (S), chlorine (Cl) [10]. Chelated minerals are a class of organic minerals that are divided into proteinates, chelates, and other complexes based on their molecular structure [11]. A chelated mineral is one that has two or more chemical interactions with peptides or amino acids, such as copper or zinc. Each one has a different level of absorption and effectiveness.
The National Research Council has studied nutrient requirements based on several criteria such as dry matter intake (DMI), total digestible nutrients (TDN), crude protein (CP), metabolic energy (ME), calcium (Ca), phosphorus (P), and other elements that affect intake and techniques of prediction [12]. The entire weight of feed minus the weight of water in the feed is expressed as a percentage and is known as dry matter. In feeding studies, dry matter intake is determined by weighing the whole ration supplied and the amount of feed left by the animal [13]. The term "total digestible nutrients" stems from an old system of calculating available energy in feeds and animal energy requirements using a complex calculation of measured nutrients. The whole amount of protein present, determined from the total nitrogen available, is referred to as a crude protein. The percent nitrogen is multiplied by 6.25 to get the percent protein. The digestible energy intake minus the energy in the urine minus the energy in the gaseous result of digestion equals the metabolizable energy. Calcium is required for bone formation, neuron function, and the production of milk and eggs in animals. Phosphorus is also included in a wide range of co-enzymes, nucleic acids, proteins and amino acids [14].
It is essential to know the significance of these nutrients in animal feed. Animal disease control, as well as feed and fodder shortages, are the most pressing issues in animal husbandry. Farmers frequently encounter the following issues.
1. Nutrient requirement for the livestock animal, 2. The amount of feed that must be supplied every day to boost productivity, 3. Feed ingredient costs must be kept under control.
Animal nutrition is necessary for livestock production to be effective. Animal feed efficiency and growth rate can both benefit from good nutrition. Diets that meet the demands of animals must be provided.
This work used goats to fully understand nutritional needs and feed composition through the use of a visual basic application. The three phases of the study are explained in this chapter, the first phase is the selection of feeds and understanding their nutrient composition. The second part involves determining which nutrients are important for animals and creating nutrient equations. The third phase entails the establishment of a linear programming model, followed by the design of the interface.

Data collection
Goats can grow well and produce maximum milk if balanced and nutritious food is fed [15]. A balanced ration should contain digestible nutrients, vitamins, and minerals, including concentrate feeds and green and dry roughages. The feed list was created based on the most commonly used feeds, fodders and its nutrient composition was used as per ICAR (2013) given in Table 1.

Nutrient requirements and estimation of nutrient requirements
Nutrient requirements are estimated based on the Indian Council of Agricultural Research (ICAR) (2013) and it was programmed in Excel VBA. A balanced ration should meet the nutrient requirement. If the growing goat does not get the nutrients, it will affect milk yield and weight at the time of slaughter [16,17]. The nutrient requirements for the growing goats are given in Table 2. There are three major factors of balanced ration: DMI, CP and TDN.
Dry Matter Intake (DMI)(kg/d): Dry matter intake is dependent upon many factors like fodder quality and quantity, climate condition, and nutrient requirement of goat. The DM requirements of goats for different body weights and growth rate functions are different [18]. The dry matter requirement is calculated based on body weight and average daily gain as per the Indian standard [19]. The total DMI intake calculated is in terms of 'kg' and the formula used in VBA code is given below:

Dim a As Integer
Dim z As Integer Dim y As Integer Energy: Energy is expressed as "Total Digestible Nutrients" (TDN). Energy allows doing physical reproductivity. It also provides for the development, lactation, reproduction, and other physiological functions such as feed digestion [20]. The TDN is calculated based on metabolic body weight and average daily gain as per the Indian standard (ICAR 2013).
From the Table 1. Will find CF1 (common factor 1) for 5, 10, 15, 20, 25, 30 kg with respective metabolic body weight (BW^0.75). the formula of CF1 is given below in eq (1) 15 kg are taken as 30.04 (average), for more than 15 kg can be taken as 30.13 (average of 3). Then we find CF2 (common factor 2) with respective average daily gain (ADG) by the following formula (eq (2)) CF2 values are found to be 1.6. Therefore (see eq (3)) ME (Mcal/d) can be found by using the following formula (eq (4)) Where 0.28 is the common factor. Protein: Protein is expressed as crude protein (CP). It is one of the major nutrients in terms of nutrition and cost. CP represents the percentage of protein present in feedstuff. CP is essential for maintenance, increasing the forage intake [21,22]. It varies for every stage of goat life. Therefore, setting CP level is very important. If the balanced ration does not meet the CP requirement, protein supplies are to be used at a greater cost [23]. At the same time, they were producing a balanced ration for these four requirements to be met compulsorily with the least cost [24]. Then the production will be more and farmers will be benefitted. The CP is calculated based on metabolic body weight and average daily gain as per the Indian standard (ICAR 2013).

CF1
CF2 values are 0.46 for less than 10 kg and 0.44 for greater than 10 kg. Therefore (see eq (7)

Research design
The developed tool (RBT) uses VBA (Visual Basic Application) as front end and back end as excel. It is a simple excel file that is saved as .xlsm form and integrated with VBA code [25]. The user form or first page asks for input data, mainly body weight (BW) in kg and expected average daily gain (ADG) in g, depending upon which, it will calculate the minimum nutrient requirements, i.e., total DMI in 'Kg', CP in 'g', TDN in 'g'. Then should be selected from the list on the second page from roughages, concentrate, and minerals. Once this information is fed, tool RBT will solve for minimization of cost with DMI, TDN, CP as constraints. The tool RBT followed the following linear programming model [26]. (see eq (8)) Objective Function: Where c i is the cost of each feed ingredient, x j represents the number of feeds, a i represents the composition of DM, TDN and CP in all feeds, b min and b max are the minimum and maximum requirement of DMI, TDN and CP, c max is the maximum limit for each feed.

Results and discussion
Ration balancing tool for growing goata Microsoft Excel VBA based software can calculate the nutritional requirements for animals, such as dry matter intake (DMI), crude protein (CP), total digestible nutrient (TDN), and metabolizable energy (ME), for which equations are derived by using common factor method based on the data of ICAR ( Once the nutrients requirements are found, the application asks the user to select the available feeds which are listed in the application. Then it will provide a balanced ration using LP model [27]. The expert nutritionist has examined the created application in NIANP, and the results of some specific animal categories (Goat 1 and Goat 2) are given in Table 3. The developed RBT will find the least-cost ration with the consumer selected feed without breaching the nutrient requirement shown in the sixth column of Table 3.    Table 3, It is observed that two different categories of goat listed for validation, DMI, CP, TDN and ME criteria, are determined depending on both the weight and average daily gain as in the second column of Table 3. The developed RBT will find the least-cost ration with the consumer selected feed without breaching the nutrient requirement shown in the fifth column. To find the optimal solution, the RBT uses the Excel solver. The Excel Solver is efficient in obtaining feasible solutions nonlinear model for goats and increased daily gain and milk yield [28]. The nutrients TDN and CP required for growing goat according to Mandal, 2005 [29] for goat 1 with the body weight of 20 kg and an ADG of 75 g are 351 g and 79 g, respectively, for goat 2 with the body weight of 20 kg and 100 g of ADG, the requirements are 446 g and 100 g respectively. The nutrients TDN and CP calculated by developed application for Goat 1 are 349.5 g and 77.74, and for Goat 2 are 444.7 g and 99.51 g. There is a very small difference 1.5 g (0.4%) and 1.26 g (0.3%) in TDN and CP for goat 1, for goat 2 TDN and CP difference is 1.3 g (1.6%) and 0.49 g (0.49%) between RBT and Mandal et al. (2017). The required nutrients for two different goat categories and calculated by balanced ration are shown in Figures 5 and 6 for goat1 and 2, respectively. From the above studies and evaluation, it can be confirmed that the calculated values for DMI, TDN and CP are almost equal to the values of ICAR (2013). A Ration Balancing Tool (RBT)" is developed using Excel VBA, which gives a balanced ration for the goats with the available ingredients that satisfy all the nutrient requirements. Many software programs are available to customize ration for the lowest cost [30]. However, scanty applications are available for goat least-cost ration formulation. This study explains how the application is exceptional and more efficient and convenient compared to all other software programs, most of which are not user-friendly, and farmers must rely on expert assistance to implement it. For the commercial business reason, many software programs are developed for the client, wherein small dairy farmers still have to rely on specialists for optimized rationing. This tool is very simple to execute and user friendly. It is designed to determine the nutritional requirement of goats, depending on their weight and daily gain and to optimize goat ration at least cost.

Steps followed for formulation
Step1: once the excel sheet is open, page 1 of the user form will appear as shown in Figure 7. This page contains three tabs 'Introduction', 'Methodology' and  'Help'. Detailed information on goat feed formulation is given in the 'Introduction' tab. The procedure to use the application is given step by step in the 'Methodology' tab. How to add excel options to the applications is mentioned in the 'help' tab.
Step2: Clicking the NEXT button, page 2 will be displayed as shown in (Figure 8) where users are required to enter input data such as body weight (kg), expected average daily gain (g) of goat. Depending on the input data, the tool RBT calculates the DMI, TDN and CP required for a particular goat.  Step3: Users must select feeds from roughages, concentrate and minerals on page 3 as shown in (Figure 9). The option is given to fix the minimum and maximum feed selected. If not, it will take standard values set by the tool. Users can also add new feeds depending on the availability in the subpage shown in (Figure 10a).
Step4: After the selection of feed has been completed, the tool RBT will provide an optimized ration cost to satisfy all nutrients at the minimum cost. If any nutrient requirement has not been met, the app will ask for feed refining where the user has to reselect the feed, this case is shown in (Figure 10b).
Step5: For the final output, the user must click on the 'Go to Result'. It opens excel sheet where the user can find.
2. Cost of 100 kg ration on dry matter basis.

Ration cost for the number of goats available.
Printouts can be taken for all the results. The features of the developed application are as follows, firstly Data Maintenance; if no feed is listed, the feed with nutrient composition can be uploaded by the consumer while selecting the feed. It allows the consumer to reasonably apply the feed available locally and reduce the cost. Consumers can get optimized ration in maximum effective steps by selecting the animal data and picking the feeds and then tapping on the "Solve" icon to get the result as it is user-friendly. For Display and printing, after the solution is found, there is an option for the result to be printed on a fed basis with feed quantity and total DM intake per kg. System requirements are also minimal as All MS Office versions can be used, and no special hardware or RAM is needed. The macros and solver options in VBA reference need to be enabled. The application provides the result in three ways: cost of single goat ration: Here, the total DMI is provided for one goat. This will help the consumer get an optimized ration and provide the right amount of roughage, concentrate, and minerals to be included in the ration. Finally, the price of each feed is given in the result. Cost of 100 kg ration on dry matter basis: Here, it estimates 100 kg at a time, which can be fed to goats at periodic intervals. The amount of roughage, concentrates, and minerals to be added to make 100 kg and its cost will be shown. Ration cost for the number of goats available: Here, the ration will be estimated on a dry matter basis for the number of available goats. The output is given in Figure 11.

Conclusions
This study showed that how the excel VBA can be used to analyzing the nutrient requirement and producing a balanced ration for livestock (goat) are fundamental aspects of reducing goats' feeding cost. Hence Excel Visual Basic Application (VBA) has been developed. Developed 'RBT' for beneficial for dairy farmers, which is based on a linear programming model. The ICAR (2013) table values for nutrients and the software-calculated values have high R2 values (DMI-0.989; TDN-1; CP-0.999). It can be confirmed from the aforementioned studies and evaluations that the computed values for DMI, TDN, and CP are nearly identical to the ICAR (2013) values. Just by giving the goat's minimum input, the application will calculate the nutrient requirement and the balanced ration at the lowest cost. Adding extra feed allows the user to add the feed available, which can lower the cost. The answer produced by the application is verified by a nutritionist at the National Institute of Animal Nutrition and Physiology (NIANP), Bangalore. Hence, it is concluded that even this application could be used quite effectively by dairy farmers. By understanding the nutrient requirements, the same can be developed for other livestock animals such as cattle, buffalo, and pigs.