LiveFlow raises $13.5 million Series A led by New York-based Valar Ventures and launches LiveFlow Next to revolutionize finance!
Read More
Arrow
Back to guides
Google Sheets Formulas

DGET Function in Google Sheets: Explained

In this article, you will learn how to use the DGET formula in Google Sheets.

What is the DGET function in Google Sheets?

The DGET function is a database function that basically extracts a single value from a column of a database table or range of cells that meet specified criteria.

You must prepare a well-organized dataset with column headers and a common rule for all database functions, such as DSUM, DCOUNT, and DCOUNTA

A sample dataset for the DGET function

When is the DGET formula beneficial in Google Sheets?

The DGET formula can be helpful in Google Sheets when you need to extract a single value from a database or a range of cells that meet specific criteria. Here are a couple of cases where the DGET formula can be helpful:

  • Getting a sales amount from a trade that meets some conditions: For example, if you have a transaction list, you can pick up a sales amount from the database based on customer name, sales region, and sales date.

  • Extracting a particular employee ID that satisfies specific requirements: For instance, if you have an employee list that includes name, age, nationality, etc., you can search it for a particular employer ID that meets the criteria you set up.

Why spend hours creating spreadsheets, when we have already done the work for you?
100+ financial spreadsheet templates, all free and ready for you now.
Free Spreadsheet Templates

How to use the DGET function in Google Sheets

You can insert the DGET formula in Google Sheets as follows:

  • Type “=DGET(“ or navigate to “Insert”“Function” (or directly go to the “Functions” icon) → “Database”“DGET”.

  • Select the entire dataset you want to analyze.

  • Choose the column header whose number of items you want to compute.

  • Input one or more criteria that items should meet.

How to insert the DGET function in Google Sheets

The general syntax of the DGET formula is as follows:

=DGET(database, field, criteria)

database: This argument should be a range or array whose first row contains table headers (or field names), followed by values in rows (from the second row and downwards) for each field. The “database” could be something like the table in the picture below.

field: This parameter should be one of the column headers in “database”. The formula extracts a value from this column that meets specific condition(s). This argument can be a text string (manual input) of the table header or a column number of the column you want to refer to, assuming the leftmost column in the selected dataset is 1. You can use a cell reference as well.

criteria: This argument should be a range or an array whose first row contains field name(s), followed by specific condition(s) in the second row and downwards.

A sample database for the DGET formula in Google Sheets

Note: While the other D-functions aggregate numbers (or the number of items) when you find more than one item that meets specific criteria, the DGET function is the only database function that doesn’t aggregate. Thus, the DGET formula returns an error value to you when it finds more than one match in the dataset. Also. it gives you an error value when it finds no match in the given data

Look at the following cases where we apply the DGET function to the sample sales list above. Imagine you want to know the specific sales amount that meets the criteria you have in mind.

In the first example, assume you need to get the sales from Client A in the list. 

  • Select the entire table, including the row showing table headers, for the “database” argument.

  • Enter the “field” by selecting the cell containing the column header whose column value that meets “criteria” is pulled out.

  • Prepare the “criteria” range as shown in the picture below. Enter a table header in a cell and a condition beneath the cell embedding the table header.

  • The formula should look as follows.
=DGET($B$2:$E$12,$E$2,$B$15:$B$16)

Although we highly recommend you use cell references in the DGET formula as they make the formula easy to follow and dynamic, if you are keen to use the DGET function with manual inputs for the “field” and “criteria” parameters, you can insert the formula as follow:

=DGET($B$2:$E$12,"Sales Amount ($)",{"Client";"Client A"})

Bear in mind that you must enclose text strings with quotation marks and enter a table header and criterion separately, split by a semicolon and surrounded by a pair of curly brackets.

You can replace the table header provided by manual input or cell reference with a column number, 4 in this case, as “Sales Amount” is in the fourth column in the dataset.

=DGET($B$2:$E$12,4,{"Client";"Client A"})

With these formulas, you can get the returned value of 1000. The formula extracts 1000 from the first row as the row contains “Client A” in the “Client” column.

How to use the DGET formula with a criterion in Google Sheets

The second example shows when the DGET doesn’t return a proper value. This happens because, as discussed in the note above, the DGET function accepts only one match. As we highlight three rows in the picture, there are three matched if we only consider the “Type Z” product in the sales list.

Thus, the formula can’t identify a match and gives you the “#NUM!# error value.

The DGET function doesn’t work well with multiple matches

So, in the third example, consider adding one more criterion that “Contract Date” is “2/5/2023“, in the DGET formula to extract one of the sales values.

As you can see, the formula shows a specific number, 6,000, as only one item meets two requirements. The formulas with cell references and manuals look as follows, respectively:
(Cell reference)

=DGET($B$43:$E$53,$E$43,$B$56:$C$57)

(Manual input)

=DGET($B$43:$E$53,$E$43,{{"Product";"Type Z"},{"Contract Date";"2/5/2023"}})

How to use the DGET formula with two criteria in Google Sheets

Learn Sheets for financial analysis today!
LiveFlow Academy teaches you the basics for free. Certificates available!
Enroll in LiveFlow Academy

What are the differences between the DGET and VLOOKUP functions in Google Sheets?

Here are some major differences between the two functions:

  • Their general syntaxes look very different, and thus the ways to enter arguments differ.

  • Concerning the first point, with the DGET formula, you can extract a specific value from anywhere in the dataset regardless of the order of the columns. However, with the VLOOKUP function, you must locate a column in which the formula finds a match as the most left column in the selected data field and put the column from which the formula pulls out a particular value in the second column or rightwards. 

  • The DGET formula can extract data based on more than two criteria. In contrast, the VLOOKUP function can only pull out a value that matches a particular lookup value from a specified column, which we could say are equivalent to two conditions.

In summary, the DGET function requires a well-organized dataset with column headings, but it is more flexible in terms of search method and the number of criteria, compared to the  VLOOKUP formula.

The world's top businesses trust LiveFlow to automate their financial reporting
We turn Quickbooks Online data into a live FP&A dashboard in Sheets FAST!
Book a Demo

Learn how to do this step-by-step in the video below 👇

Automate financial reporting with LiveFlow

Cta Photo

Want to eliminate manual updates of your Excel & Google Sheets models?

Yes, show me how!

Get personal help

We guarantee you personal help on chat or Zoom within maximum 6 hours between 9am and 10pm EST.
Blue Tick
Email us at: help@liveflow.io

Liked this article? Then you'll love the ones below

Supercharge your financial reporting today

See LiveFlow in action and discover how to streamline your workflows.

Book a demo