DGET Function in Excel

The DGET function extracts a single value from a database table that matches specific criteria. Master DGET for precise data retrieval in Excel.

ExcelExcel
Google SheetsGoogle Sheets
database
intermediate
Syntax Preview
ExcelExcelGoogle SheetsGoogle Sheets
=DGET(database, field, criteria)
What is the DGET Function?
Syntax and Parameters Explained

Practical Examples

Basic Employee Salary Lookup

Extract an employee's salary using their unique Employee ID

Result: $72,000

Product Information Retrieval with Multiple Criteria

Retrieve product price using SKU and category validation

Result: $79.99

Date-Based Record Extraction

Extract transaction amount for specific date and account combination

Result: $5,000

Error Handling with IFERROR

Gracefully handle cases where unique match might not exist

Result: No unique match found

Using Comparison Operators in Criteria

Extract sales representative for territory meeting performance threshold

Result: Alice Brown

Validating Uniqueness with DCOUNT

Check match count before extraction to prevent errors

Result: John Smith

Cross-Sheet Database Lookup

Extract data from database on different worksheet

Result: $24.99

Common Errors and Solutions

#NUM!

DGET returns #NUM! error

Cause:

This error occurs when DGET finds zero matching records OR more than one matching record. The function requires exactly one unique match. This is DGET's built-in validation mechanism ensuring data integrity.

Solution:

**Step 1:** Verify your criteria identifies exactly one record by reviewing the conditions. **Step 2:** Check if criteria headers match database headers exactly - matching is case-sensitive, so 'EmployeeID' differs from 'employeeid'. **Step 3:** Add additional criteria columns to narrow results to a single match. For example, if searching by Name returns multiple people, add Department or ID criteria. **Step 4:** Use DCOUNT(database, field, criteria) to verify match count before using DGET. A count of 1 confirms uniqueness. **Step 5:** Ensure no duplicate records exist in your database. Check for data entry errors or repeated imports. **Example Prevention:** ``` =IF(DCOUNT(A1:D10,"ID",F1:F2)=1, DGET(A1:D10,"Name",F1:F2), "Not unique") ```

Prevention:

Always design criteria to target unique identifiers like IDs, SKUs, or account numbers. Test with DCOUNT first to confirm exactly one match exists. In database design, ensure primary keys are truly unique.

#VALUE!

DGET returns #VALUE! error

Cause:

Occurs when the field parameter doesn't match any column header in the database, or when the criteria range is improperly formatted. This indicates a mismatch between your formula parameters and the actual database structure.

Solution:

**Step 1:** Verify the field name matches a database header exactly. Check for spelling errors, extra spaces, or case differences. **Step 2:** Ensure field is enclosed in quotes if using text: "Salary" not Salary (without quotes). **Step 3:** Check column number is within database range if using numeric field reference. If database has 5 columns, field cannot be 6. **Step 4:** Verify criteria range structure has headers in first row followed by condition values in subsequent rows. **Step 5:** Remove any merged cells in the criteria range as they cause structural issues. **Example Fix:** ``` Instead of: =DGET(A1:D10, Salary, F1:F2) Use: =DGET(A1:D10, "Salary", F1:F2) ```

Prevention:

Use cell references for field names to avoid typos: =DGET(A1:D10, E1, F1:F2) where E1 contains "Salary". Validate criteria range structure has proper header-value pairs. Create named ranges for frequently used fields.

#NAME?

DGET shows #NAME? error

Cause:

Excel doesn't recognize DGET as a valid function name. This typically indicates a typo in the function name, though it could also suggest Excel version incompatibility or regional function naming issues.

Solution:

**Step 1:** Check spelling carefully: DGET (not DGET, D-GET, D_GET, or DGETT). **Step 2:** Verify your Excel version supports database functions. DGET is available in Excel 2007 and later. **Step 3:** Check if you're using regional function names. Some localized Excel versions use different function names. **Step 4:** Ensure no hidden characters or extra spaces in the function name. **Step 5:** Try using Excel's function wizard (fx button) to insert DGET, which ensures correct spelling.

Prevention:

Use Excel's formula IntelliSense by typing =DG and selecting DGET from the autocomplete dropdown. This prevents spelling errors. Update to a supported Excel version if necessary. For Google Sheets users, verify DGET spelling as it's identical to Excel.

#REF!

DGET displays #REF! error

Cause:

Referenced ranges have been deleted or moved, or the criteria/database ranges contain invalid references. This occurs after worksheet modifications that affect the formula's range references.

Solution:

**Step 1:** Check if rows or columns in the database or criteria ranges were recently deleted. Use Undo (Ctrl+Z) to restore if possible. **Step 2:** Update database range to reflect current data location. Click the formula cell and edit range references in the formula bar. **Step 3:** Fix criteria range references if they point to deleted cells. **Step 4:** Use structured references (Excel Tables) which automatically adjust when data moves: =DGET(Table1[#All], "Price", CriteriaRange). **Step 5:** Rebuild the formula with current valid ranges if restoration isn't possible.

Prevention:

Convert your database to an Excel Table (Ctrl+T) for automatic reference updates. Use named ranges for criteria areas. Avoid deleting rows/columns within database ranges - use filtering to hide unwanted data instead. Document database structure before making structural changes.

Example:

Best Practices and Pro Tips

Always Use Unique Identifiers in Criteria

Design your criteria to target unique keys like employee IDs, SKUs, product codes, or account numbers rather than names or descriptions. This prevents #NUM! errors from multiple matches and ensures reliable data extraction. Names can have duplicates, but properly designed IDs guarantee uniqueness.

Validate Match Count Before Extraction

Use DCOUNT to verify exactly one match exists before running DGET. This prevents errors and provides better user feedback in complex scenarios: =IF(DCOUNT(A1:D10,1,F1:F2)=1, DGET(A1:D10,"Name",F1:F2), "Error: Check criteria"). This pattern is especially valuable when criteria complexity might result in zero or multiple matches.

Use Named Ranges for Maintainability

Define named ranges for database and criteria areas to make formulas more readable and easier to update when data structures change. For example, define 'EmployeeDatabase' for A1:E100 and 'LookupCriteria' for G1:H2, then use =DGET(EmployeeDatabase, "Salary", LookupCriteria). This improves formula clarity and reduces errors when updating ranges.

DGET is Case-Sensitive for Text Criteria

Text matching in criteria is case-sensitive. 'Sales' and 'sales' are treated as different values, which can cause unexpected #NUM! errors when no match is found. If you need case-insensitive matching, add a helper column using =LOWER(A2) or =UPPER(A2), then apply DGET with lowercase or uppercase criteria.

Combine Multiple DGET for Related Data

Extract multiple fields from the same record by using several DGET formulas with identical criteria. This ensures data consistency across extractions: Name: =DGET(DB,"Name",Crit) Salary: =DGET(DB,"Salary",Crit) Dept: =DGET(DB,"Department",Crit) All extractions use the same matching logic, guaranteeing the data comes from the same record.

Wrap Production Formulas in IFERROR

Always use IFERROR wrapper for production spreadsheets to handle unexpected errors gracefully: =IFERROR(DGET(A1:D10,"Email",F1:F2), "Record not found or not unique"). This prevents confusing error codes for end users and provides clear, actionable feedback. Consider different error messages for different scenarios to guide users effectively.

Convert Database to Excel Tables

Use Excel Tables (Ctrl+T) for your database range to enable automatic expansion when new rows are added. Table references like =DGET(Table1[#All], "Price", Criteria) automatically adjust, eliminating manual range updates. Tables also provide structured references that are more readable and maintain integrity when columns are inserted or deleted.

Use Comparison Operators for Numeric Filtering

Leverage comparison operators in criteria cells for sophisticated filtering: >100, <50, >=1000, <=500, <>0. Enter these directly in criteria cells below the header. This enables queries like 'find the employee in Sales department with salary >$80,000' by combining exact match (Sales) with numeric comparison (>80000).

DGET vs Alternative Functions
Related Database Functions

Need Help with DGET Function in Excel?

Stop struggling with formula syntax. Use AskFormulas to generate validated formulas instantly with our AI-powered tool.

Example Excel formula:

Related Formulas

DAVERAGE Function in Excel

Master DAVERAGE to calculate database averages with multiple criteria. Learn syntax, examples, and solutions for Excel and Google Sheets.

intermediate
database
ExcelExcel
Google SheetsSheets
Validated
DCOUNTA Function in Excel

Master DCOUNTA to count non-empty cells in databases with multiple criteria. Learn syntax, examples, and solutions for Excel and Google Sheets.

intermediate
database
ExcelExcel
Google SheetsSheets
Validated
DSUM Function in Excel

Master the DSUM function to sum database values with complex criteria. Learn syntax, advanced examples, and when to use DSUM vs SUMIFS.

advanced
database
ExcelExcel
Google SheetsSheets
Validated
VLOOKUP Function Guide

Master the VLOOKUP function with practical examples and error solutions. Learn how to search and retrieve data efficiently in Excel and Google Sheets.

intermediate
lookup
ExcelExcel
Google SheetsSheets
Validated