## 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

- Click on an
**empty**cell (like F5 )

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

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

4. Select **Database** category

5. Select t** he 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

## Examples of DGET function in excel

### Example 1: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

**=DGET(Table1[#All],C1,A1:D2)**----->>>>answer is 205

### Example 3: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?

Name | Age | Height | Weight |

Olivia | 25 | 210 | 180 |

Noah | 25 | 205 | 235 |

Oliver | 27 | 195 | 205 |

Elijah | 22 | 198 | 185 |

James | 29 | 199 | 231 |

William | 29 | 201 | 240 |

Benjamin | 21 | 202 | 235 |

Lucas | 25 | 200 | 238 |

Henry | 22 | 204 | 190 |

A1=”Name” & A2=”Benjamin”

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

### Example 5:Python code for **DGET** function

**DGET**Name | Age | Height | Weight |

Olivia | 25 | 210 | 180 |

Noah | 25 | 205 | 235 |

Oliver | 27 | 195 | 205 |

Elijah | 22 | 198 | 185 |

James | 29 | 199 | 231 |

William | 29 | 201 | 240 |

Benjamin | 21 | 202 | 235 |

Lucas | 25 | 200 | 238 |

Henry | 22 | 204 | 190 |

```
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.