Mapping Spreadsheet Calculator

This spreadsheet calculator requires Microsoft Excel™ version 2007 or newer.

The syntax of an Excel Spreadsheet for the Spreadsheet calculator is fairly simple but there are specific naming or labeling rules that are important to understand.

Multiple Worksheets

There must be a worksheet for every permutation and combination of the conditionals. For example, if there are five crops, there will need to be five worksheets. As in the example above, one workbook can be created for each nutrient and that workbook can contain several worksheets - one for each different crop that might be needed.

Conditionals

The block in blue is the Conditionals named range. It contains a row for every conditional that is defined for the workbook. The first column (Column B) is the name of the conditional and the second column (Column C) is the value of the conditional for this worksheet. These become the RequiredConditional properties of a SpreadsheetCalculatorOption. The Spreadsheet.SelectOption method will search each worksheet to find the one that has RequiredConditional values that match the ActualConditional values that have been set on the SpreadsheetCalculator class. The individual conditionals do not need to be named ranges, but the blue box must be explicitly named Conditionals and must be a sheet-specific name, not a workbook-specific name.

Variables

The Variables named range is shown in pink. It must have three columns: a variable name, its value in the calculation (updated automatically by the calculator for each row of the dataset) and a unit-of-measure. For now, the input cells (where the 110, 12, and 150 are) should be single cell named ranges, with the name being the variable name (K, CEC, and Yield). This will change as an absolute requirement but will always be a recommended practice.

The Units fields have specific requirements. Acre, for example, must be spelled out as acre and not the common abbreviation, ac. pH is another in that its range must be named pHw to work properly.

Acceptable units for these variables are: ppm, lbs per acre (st), meq/100g, tons/acre, bu/acre, and none. No other unit types or names will work. Select the one to use for the given variable. Below is a table of variables and their syntax:

VariableRange Name
BB
CaCa
CuCu
CECCEC
ENRENR
FeFe
KK
MgMg
MnMn
NO3-1NO3_1
NO3-2NO3_2
OMOM
*P1P_1
P2P_2
pHwpHw
pHbpHb
Previous CropPrevious_crop
SS
**YieldYield
ZnZn
Years to buildYears_to_build
Soil Class (A-E)Soil_class

* It’s critical that no Range names mimic a MS Excel cell address. In the table above, the common nutrient expression, P1, is such a case, so the Range name, P_1, is used.

** No other word or part of a word in the variable section can contain the word, Yield. This is a reserved word used in the calculation. For example, use SoybeanYld, rather than SoybeanYield if you have need for a variable like that.

Results

The Results named range is shown in green. At this time, it has three required columns: result name, result value, and result unit. The value cell (the 110) should:

  • Contain the formula used to calculate the value from the variables.
  • Be explicitly typed as text, numeric, etc.
  • If numeric, have a format defined that shows the number of decimal places, etc.

In the current implementation, the formula should use name range references for the variables, rather than cell references. For example, IF (K < 151… rather than IF (C6 < 151… This will change in a future build, but will always be a recommended practice.

The Results area has specific cell Range names required for the nutrients used in the calculator. The units for the nutrient recommendations can be either lbs/acre or tons/acre. UD_Rec in the last row stands for the one User-Defined nutrient allowed in Agvance. The table below displays those Range names:

NutrientRange Name
N_RecN_Rec
P_RecP_Rec
K_RecK_Rec
Ca_RecCa_Rec
Mg_RecMg_Rec
S_RecS_Rec
B_RecB_Rec
Cu_RecCu_Rec
Fe_RecFe_Rec
Mo_RecMo_Rec
Zn_RecZn_Rec
Lime_RecLime_Rec
CCE_RecCCE_Rec
UD_RecUD_Rec

Building a Spreadsheet

Label the worksheet tab by double-clicking the current name (ex. Sheet 1) and typing the equation name.

  1. Type Conditionals: in the first cell.
  2. Type the conditionals into the rows below using one conditional per row (ex. Crop).
  3. In the adjacent column, enter the conditional values (ex. Corn).
  4. Select the cells that make up the conditional labels and values (B2:C2 in the beginning of the article).
  5. Choose the Formulas menu option and select Define Name. If using Excel version previous to Office 2007, go to Insert / Name / Define.
    • Name – Conditionals
    • ScopeWorksheet name (not Workbook)
    • Comments – None
    • Refers to – Default
  6. Choose OK.
  7. Type Variables: in the first cell in a row below the Conditionals section.
  8. Enter the variables into the rows below using one row per variable (ex. K, CEC, Yield).
  9. Leave the adjacent column empty for now as this will be where the variable value is entered.
  10. In the next column, enter the unit of measure for each variable (ex. ppm, meq/100g, bu/acre).
  11. Select the value cell adjacent to the variable label.
  12. Choose the Formulas menu option and select Define Names.
    • Name – variable name (ex. K)
    • Scope – Worksheet name (not Workbook)
    • Comments – None
    • Refers to – Default
  13. Select OK.
  14. Upon selecting the variable value cell, the name will be visible in the Name field of Excel instead of the cell name like C8.
  15. Repeat Steps 12-14 for the remaining variables.
  16. Select each/all variable value cell(s), right-click, and choose Format Cells.
  17. Enter the Category and other information (ex. For numeric data, select Number, two decimals).
  18. Select the cells that make up the variable labels and values.
  19. Choose the Formulas menu option and select Define Names.
    • Name – Variables
    • Scope – Worksheet name (not Workbook)
    • Comments – None
    • Refers to – Default
  20. Select OK.
  21. Type Results: in the first cell in a row below the Variables section.
  22. Enter the results label(s) into the rows below using one row per result (ex. K_Rec).
  23. Leave the adjacent column empty for now as this will be where the results value equation is entered.
  24. In the next column, enter the result unit (ex: lbs/acre).
  25. Select the value cell adjacent to the results label.
  26. Select the Formulas menu option and choose Define Names.
    • Name – Result name (ex. K_rec)
    • Scope – Worksheet name (not Workbook)
    • Comments – None
    • Refers to – Default
  27. Select OK.
  28. Repeat Steps 23-27 for each additional Result.
  29. Select the result value cell(s), right-click, and choose Format Cells.
  30. Enter the Category and other information (ex. For numeric data, select Number, zero decimals).
  31. Select the cells making up the results labels and values.
  32. Select the Formulas menu option and choose Define Names.
    • Name – Results
    • Scope – Worksheet name (not Workbook)
    • Comments – None
    • Refers to – Default
  33. Select OK.
  34. Choose the result value cell and enter the equation in the Formula Bar.
  35. Use the variable names (ex. CEC), not cell names (ex. C6) in the equation.
  36. Repeat Step 35 for additional results.
  37. Test the equation by entering values for the variables.
  38. Repeat all steps for each additional worksheet.
  39. Save the workbook.