DGET Syntax and Arguments
A function’s syntax is the structure Excel uses to execute your request.
The syntax and arguments for the DGET function are:
All database functions have the same three arguments:
Database (required): Specifies the range of cell references containing the database. The field names must be included in the range. Field (required): Indicates which column or field is to be used by the function in its calculations. Enter the argument either by typing the field name or the column number. Criteria (required): Lists the range of cells containing the specified conditions. The range must include at least one field name from the database and at least one other cell reference indicating the condition to be evaluated by the function.
Match a Criterion With DGET
The example shown in this tutorial uses the DGET function to find the number of sales orders placed by a specific sales agent for a given month.
To follow along with this tutorial, enter the data shown in the above image into a blank Excel worksheet.
Select the Criteria
To get DGET to only look at data for a specific sales rep, enter the name of an agent under the SalesRep field name in row 3. In cell E3, type the criteria Harry.
Name the Database
Using a named range for large ranges of data such as a database makes it easier to enter this argument into the function and it prevents errors caused by selecting the wrong range.
Highlight cells D6 to F12 in the worksheet to select the range. Place the cursor in the Name Box. Type SalesData. Press Enter to create the named range.
Enter the DGET Function
Now you’re ready to enter the DGET function and create the formula along with the function arguments.
Select cell E4. This is where the results of the function will display. Select Insert Function (the fx symbol located to the left of the Formula Bar) to open the Insert Function dialog box. In Excel for Mac, the Formula Builder opens. In the Search for a function text box, enter DGET and select GO. Select the DGET function in the Select a function list and select OK. Except in Excel for Mac, where you select Insert Function. Place the cursor in the Database text box. Enter SalesData. Place the cursor in the Field text box. Enter #Orders. Place the cursor in the Criteria text box. Highlight cells D2 to F3 in the worksheet to enter the range. Select OK. Excerpt in Excel for Mac, where you select Done. The answer 217 appears in cell E4. This is the number of sales orders placed by Harry.