Creating a Function from a 2D Excel Array

In this example, we will demonstrate how to create a 2D array in Excel using the "F+E Mhr.xlsx" file. Specifically, we will show how to look up the value of manhours based on the piping diameter and schedule.

The process is nearly identical to the steps we followed in the previous section for creating a 1D array.

  1. Go to the ribbon bar and select Tools & Help >> Function Development.

Ribbon bar

A new dialog box will open. Normally the left panel will be blank.

  1. Click the +Add button located at the bottom right corner.

A new dialog box will appear. Do the following steps:

  1. Give a Name to the new function (e.g, MHR).
  2. Set the Result Type. Select what type of results the function will return. Select Decimal if it returns a number, Text if it returns text, etc. (in our case we select Decimal).
  3. Set the Grouping (e.g., CEI Functions)

Set up Declaration Window

  1. Click the Add from excel button.

Function Add From Excel Button

Next

  1. Select TWO DIMENSIONAL LOOK UP TABLE.

Two Dimensional Window

Once selected fill the input arguments and properties aa follow:

  1. Set the Variable Name.
  2. Set the Selection List.
  3. Set the Type/Sort Order.
  4. Finally select the Create Excel File.

Create Two Dimensional Table

Warning

A variable name should be a single, meaningful word without spaces, starting with either an uppercase or lowercase letter, and it should accurately reflect the variable's purpose

  1. Select a path where to save it and give a name to the new file.

Create Excel File Two Dimension

A new blank excel file will open.

Empty Excel Sheet Two Dimension

  1. Copy and paste values (use the F+E Mhr.xlsx file ) and Save.

Filed With Values Excel Sheet Two Dimension

  1. Go back to CostOS and click Generate.

Empty Excel Sheet Two Dimension

The arguments of the new function are now created.

New Function Two Dimension

  1. Click Setup Implementation.

Implementation Button

  1. Drag and drop the MHR argument into the Implementation area and click Add button located at the bottom right corner.

Drag and Drop Two Dimension Argument

Use the selection list to check if the results are accurate.

MHR Declaration