Excel allows a user to get a single value from a database using the DGET function. This step by step tutorial will assist all levels of Excel users in getting a value from a database for given criteria.
Figure 1. The result of the function
Syntax of the DGET Formula
The generic formula for the DGET function is:
=DGET(database, field, criteria)
The parameters of the DGET function are:
- database – a table containing data
- field – a field which value we want to get
- criteria – a table containing conditions for selecting a result
While creating a criteria range, we must be sure to have the same header as in a database table.
Setting up Our Data for the DGET Function
Figure 2. Data that we will use in the DGET example
Let’s look at the structure of the data we will use. Our database table consists of 3 columns: “Delivery Number” (column B), “Delivery Date” (column C) and “Amount” (column D). The database range is B2:D9. The criteria range is B11:D12 and has the same header as the database. In the cell F3, we want to get the amount from the database for the selected criteria.
Get an amount from the database using the DGET function
In our example, we want to get an amount from a column D of the database. The conditions are Delivery number 1004 and Delivery date 2-Nov-18.
Figure 3. Using the DGET function to get an amount from the database
The formula looks like:
=DGET(B2:D9, "Amount", B11:D12)
The database is the B2:D9 range, containing the database. The parameter field is “Amount” as we want to get a value from the amount columns. The range B11:D12 is the criteria parameter, containing the conditions for data selection.
As a result, we get the amount which has the corresponding Delivery number 1004 and Delivery date 2-Nov-18. Finally, the result in the cell F3 is $450.
To apply the DGET function, we need to follow these steps:
- Select cell F3 and click on it
- Insert the formula:
=DGET(B2:D9, "Amount", B11:D12)
- Press enter
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.
Leave a Comment