Function DGET
When you search a range of data, for example, by using the VLOOKUP function, the search is always performed by using a unique criterion. How to perform multiple searches or quickly change criteria? In the following text, you will learn about the DGET function, which allows for greater flexibility and easier finding of the required values in a given range.
Let’s start with a simple table that shows the code, name, department and salary of employees in a company.
The DGET function has the following syntax:
DGET(<database>,<field>,<criteria>)
If you use US regional settings you should enter comma after each argument. Author uses Serbian regional settings, so you’ll see semicolon instead.
The first argument is the range or table (database) being searched, the second is the name of the column on which the search is performed, and the last is the search criteria.
To start the search, enter the code in cell A2 to search for the data. Let it be number 3. Next, in B2, we enter the formula to search for the name:
=DGET($A$4:$D$14; B4;$A$1:$A$2)
You can see the result in the picture.
As you can see, the first and third arguments are the ranges that we have fixed. The second argument is the address of cell B4. By simply copying the formula to the right, we will get the result for all the other criteria.
By changing the criteria, i.e. the employee code or the column in which the search is performed, we perform a quick name of the criteria in order to find the desired value.