DGET Function in Excel

What is DGET Function in Excel?


The DGET function is one of the Database functions of Excel.

It extracts a single record from the database that matches the specified conditions.

We can find this function in the Database of the insert function Tab.

How to use DGET function in excel

  1. Click on an empty cell (like F5 )
Click on an empty cell

2. Click on the fx icon (or press shift+F3)

fx icon

3. In the insert function tab you will see all functions

insert function tab

4. Select Database category

5. Select the DGET function

6. Then select ok

7. In the function arguments Tab you will see the DGET function

8. In the Database section you can enter the range of cells that make up the list or database. A database is a list of related data (ex: Table1)

9. Field section is either the label of the column in double quotation marks or a number that represents the column’s position in the list

10. Criteria section is the range of cells that contains the conditions you specify. The range includes a column label and one cell below the label for a condition (ex: Table1)

11. You will see the result in formula result section

How to use DGET function in excel

Examples of DGET function in excel

Example 1:Find the Age of the student with DGET function

 Find the Age of the student with DGET function
=DGET(Table1[#All],"Age",A1:D2)----->>>>answer is  25

Example 2:Find the Height of the student with DGET function

Find the Height of the student with DGET function
=DGET(Table1[#All],C1,A1:D2)----->>>>answer is  205

Example 3:Find the Weight of student with DGET function

Find the Weight of student  with DGET function
=DGET(Table1[#All],D1,A1:D2)----->>>>answer is  235

Example 4:How can extract specific record from table in excel?

By using DGET function, we can extract a specific record from table in excel

For example, in the table below, we want to know how old is benjamin?

NameAgeHeightWeight
Olivia25210180
Noah25205235
Oliver27195205
Elijah22198185
James29199231
William29201240
Benjamin21202235
Lucas25200238
Henry22204190

A1=”Name” & A2=”Benjamin”

=DGET(Table1[#All],"Age",A1:A2)----->>>>answer is  21

Example 5:Python code for DGET function

NameAgeHeightWeight
Olivia25210180
Noah25205235
Oliver27195205
Elijah22198185
James29199231
William29201240
Benjamin21202235
Lucas25200238
Henry22204190
import pandas as pd

data=pd.read_csv(‘example.csv’)

df = pd.DataFrame(data)

result=df.loc[lambda df: (df[‘Name’] ==’Noah’ )]

print(result)

What is the purpose of DGET function?

It extracts a single record from the database that matches the specified conditions.

What is the Return value  of DGET function?

It can return any type of data (number,text,….).

DGET (database, field, criteria)=number,text,....

How many arguments does DGET function have?

DGET(database, field, criteria)

DGET function has 3 arguments.

  • In the Database section you can enter the range of cells that make up the list or database
  • Field section is either the label of the column in double quotation marks
  • Criteria section is the range of cells that contains the conditions you specify

Which version of excel supports DGET function?

this function is available for all excel versions (2003-2019)

Errors in DGET function

If no record matches the criteria, DGET returns the #VALUE! error value.

If more than one record matches the criteria, DGET returns the #NUM! error value.

Conditions and criteria range in DGET function

Criteria argument in DGET function

we can define any range for the criteria argument: it has 2 condition

1. At leastone column label

2. At least one cell under the column label.

For example, if the range A1:A2 contains Name in A1 and Benjamin in A2,

you could define A1=”Name” & A2=”Benjamin”

Dget function find the word of “Benjamin” under “name” column

location of Criteria range in DGET function

Although the criteria range can be located anywhere on the worksheet, do not place the criteria range below the list. If you add more information to the list, the new information is added to the first row below the list. If the row below the list is not blank, Microsoft Excel cannot add the new information.

Make sure that the criteria range does not overlap the list.

To perform an operation on an entire column in a database, enter a blank line below the column labels in the criteria range.

DGET related functions :

Leave a Reply

Your email address will not be published. Required fields are marked *