代做ANSC 221 HWEX1 Excel Spreadsheet for Nutritional Calculations帮做R编程

2025-04-11 代做ANSC 221 HWEX1 Excel Spreadsheet for Nutritional Calculations帮做R编程

ANSC 221  HWEX1

Homework Exercise – Excel Spreadsheet for Nutritional Calculations

The purpose of this exercise is to learn some elementary things about use of Excel spreadsheets for making calculations, that can be very useful in nutrition.  Many of you may already know all of these things and more (and that s fine), and others may have never used Excel, so this will be at a very simple level.

You are to make a spreadsheet that will make useful calculations.  Print a copy of the spreadsheet to turn in (so it should be arranged to nicely fit on one page).

Follow these directions:

In Cell A1 type ANSC 221 Homework Excel-1 {YOUR NAME} and press Enter.  (Of course type your own name and not literally “{YOUR NAME}”

I will show you how to make a simple ration checking program that will multiply feed amounts times the nutrient content of feeds, and add up the results.  List some feeds in rows 3 through 10 in column 1.

Now copy those feed names to rows 13-20 by doing the following.  Highlight the feed names you typed in rows 3-10.  Hit Control-C.  Place your cursor in cell A13 and left click the mouse.  Press Control-V (which pastes what you copied with Control-C).  Let s also copy those names to cells A23 to A30.  Press ESC (escape) to release the area you highlighted.

Let s format this so the feed names all sit in column A.  Move your cursor to the spot between the A and B at the top of the spreadsheet cells.  Left click, and when the cursor changes to a line with arrows to both sides, left-click again and drag the A-column wider so that the feed names all fit within column A.

Let s put labels above the columns:  on row 2 in column B enter AMOUNT, in C enter CP, in D enter TDN, in E enter CA, in F enter P.  Of course you could do the same thing with other and more nutrients.

From data on nutrient content (from somewhere), enter the percentage of CP, TDN, Ca, and P for the feeds you chose.  (Leave the “Amount” column blank).

Next, we are going to want to multiply the feed amounts we specify by the DECIMAL values for the percentages we entered, or in other words, by those amounts divided by 100.  Let s go to Cell C13 (for timothy hay on my sample page, CP column) and write a formula that takes the value in cell C3 and divides it by 100.  Start your formula by entering the = sign.  So in cell C13 enter = then click on cell C3, enter “/” (for divide) enter 100 and then press the enter key. (To multiply it would be the asterisk symbol, *)

Now we could do that for every cell, but there is a much faster way.  Click in cell C13.  Notice at the bottom right the box has a dense square.  Move your cursor over it until it forms a +. Click that square and drag right to copy the contents (the formula) to Cells D through F.  Alternatively, in Cell C13 we could have hit Control-C, clicked in Cell D13, dragged right to Cell F13, released and pressed Control-V (and it would do the same thing).  CTRL-C copies to your clipboard, and CTRL-V pastes from your clipboard.

Note that to undo something you could click the circular arrow pointing left at the top, and to redo you could click the circular arrow to the right at the top of the page.  Sometimes Excel is not set up with all   the same icons in the same page, but that can be adjusted and they are commonly there.

Now let s copy those formulas down.  Click in C13 and drag right to highlight C13-F13.  Release the click, and then hover over that dot in the lower right corner of the line around the cells highlighted, and then  drag down to include row 20, then release.  (This could also be done with CTRL-C – CTRL-V.)

Now let s make our multiplications.  First you may enter values for each feed amount in column B, rows 23-30.  These are the values you can change to get different results, so for now it isn t important what value you enter, BUT MAKE THEM DIFFERENT FROM THE EXAMPLE PAGE so it shows your sheet makes calculations.  But we want EACH value (in column B) multiplied by the correct value in column C.  If you enter a formula in cell C23 as we did in cell C13 and then copy that, the program will automatically adjust the formula.  We don t want it to change the formula, we want it to always use the value in column B, so we are going to enter a “$” sign in front of a cell reference to “root” it so that it doesn t change.  In Cell C23 enter:  =$B23*C13 and press enter.  The calculation is shown (but the cell contains the formula).  Now we can copy the formula in Cell C23 to cells D, E and F.  (Do that with the click, click the + and drag, or use the CTRL-C, CTRL-V method).  Then you can highlight all 4 cells (C23-F23) and copy them down to row 30 (by either method).

(There is another way we could do all of this.  Instead of making a second table with all the values divided by 100, we could put that into the formula in which we multiply the amount of feed times the percent nutrient in the feed.  That formula would look like:   “=$C23*(C3/100)”.

Your multiplications have all been made.  Now let s add up those columns.  In column B, row 31 enter =sum( and then click and drag to highlight cells B23-30, and then enter “)” (the close parenthesis symbol) and press enter.  Now copy that formula right to make rows D-F calculate the sums.

Let s separate the result from the data with some formatting.  First in Cell A31 lets enter 2 spaces and  the word TOTAL.  Then highlight the 5 zeros in line 30 in Cells B-F.  Click the box at the top of the page  for formatting, located above the word   Font .  The down symbol there would present various choices. The default choice is probably Bottom Border, and that is what we want.  Click that (or chose that and  click it) and a line will be drawn between our data and the results on the total line.

Now you can change the values for the amounts of the feeds, and see the resulting calculations.  If you adjust the feed amounts so they total to 100, then the results calculated will be the percentage for the nutrients you are calculating (because recall, percentage is parts in 100 parts).

This spreadsheet could have taken different structures.  The decimal values for nutrient composition could have been used in the first place, or those calculations could have been made, and used, from further right on the page where they would not show so easily.  I put each above each other so you could see what was going on, and we could still print the page and have everything show on one page.

Let s do another calculation.  Press Page Down to move us lower on the spreadsheet, as if it were a different page.

In the top cell (Cell 35 in my example), enter your name again, ANSC 221 homework, Proximate Analysis, TDN.

In Cell 37 through Cell 42, row A, enter Water, Nitrogen, Crude Protein, Ether Extract, Crude Fiber, Ash and NFE.  In column B enter values for Water, CP, EE, CF and ASH.  In Cell B42 enter the formula: =100-SUM(B37:B41).  (We could have used the cursor to highlight cell B37 to B41 and it would write that part, and we only need to enter the close-parenthesis symbol and hit enter).

Maybe we have the nitrogen value instead of the CP value.  Let s calculate that.  In cell A46 enter NITROGEN, in cell C46 enter the formula =B46*6.25 and press enter.  Then a value entered in B46 will result in the calculation of CP.  Let s put “CP” above that in cell C45.  That sits clear at the left, and we  can change the formatting of the cells with the icons at the top of the page.  Let s make both sit in the center of the cell.  Highlight cells C45 and C46 and find the “CENTER” icon in the alignment area, and click that.

Now let s calculate TDN.  We need the energy value so place that in column C (enter ENERGY in Cell C36).  Values are water=0, CP=1, EE=2.25, CF=1, Ash = 0, NFE=1.  We need digestibilities so enter those in column D, in the decimal format.  Label that column DIG in Cell D36.

Now label Column E TDN.  Then make the formula in cell E37 contain: =B37*C37*D37 and press enter. Then copy that formula down to E42.  All the partial products are calculated.  Add them up in Cell E43  (or E44 if you prefer).  The formula is =SUM(E37:E42).

To make it obvious, let s place “TDN =” in column D ahead of the calculated TDN.

You can print the results.  In my program on my computer, that will all print on one page.  You have many choices for what you print, how big it is and how it is formatted.  When you print spreadsheets though you should make them easily readable and presentable.  To save your work, click File then choose Save AS and choose a location and filename of your choice.

ANSC 221 Example spreadsheet homework exercise - D. M. Forsyth

 

AMOUNT

CP

TDN

CA

P

Timothy Hay

 

12

55

0.8

0.5

Alfalfa Hay

 

18

56

1.4

0.6

Corn

 

8

80

0.02

0.28

Soybean meal

 

44

78

0.25

0.6

Cottonseed meal

 

42

77

0.3

0.64

Dical

 

0

0

24

18.5

Limestone

 

0

0

38

0

other

 

 

Timothy Hay

 

 

 

 

0.12

 

 

 

0.55

 

 

 

0.008

 

 

 

0.005

Alfalfa Hay

 

0.18

0.56

0.014

0.006

Corn

 

0.08

0.8

0.0002

0.0028

Soybean meal

 

0.44

0.78

0.0025

0.006

Cottonseed meal

 

0.42

0.77

0.003

0.0064

Dical

 

0

0

0.24

0.185

Limestone

 

0

0

0.38

0

other

 

0

0

0

0

 

Timothy Hay

 

20

 

2.4

 

11

 

0.16

 

0.1

Alfalfa Hay

15

2.7

8.4

0.21

0.09

Corn

50

4

40

0.01

0.14

Soybean meal

5

2.2

3.9

0.0125

0.03

Cottonseed meal

2

0.84

1.54

0.006

0.0128

Dical

0.5

0

0

0.12

0.0925

Limestone

0.5

0

0

0.19

0

other

7

0

0

0

0

TOTAL

100

12.14

64.84

0.7085

0.4653

ANSC 221 homework, Dale Forsyth, Proximate Analysis, TDN

amount          Energy         DIG            TDN

Water                               10                   0               1              0

CP                                    12                   1              0.8             9.6

EE                                     4                2.25            0.75          6.75

CF                                     6                    1               0.4             2.4

Ash                                   2                     0              0.5                0

NFE                                 66                    1              0.8           52.8

TDN =           71.55

CP

NITROGEN                                2         12.5