DGET

DGET(database, field, criteria)

Returns the single value in a column that satisfies multiple conditions.

databaseThe range of cells that make up the table or list.
fieldThe column name or number indicating which column to use.
criteriaThe range of cells that contain the conditions.

REMARKS
* For an illustrated example refer to the Specifying Database Criteria page.
* Any cells containing logical values, text and errors are not included. See Examples 7.
* This function supports wildcards (? and *).
* The "database" range of cells can be a single column. See Example 5.
* The "database" range of cells must contain column headings in the first row.
* If the "database" range refers to a cell inside a pivot table, this will refer to the data currently displayed in the pivot table.
* The "field" can be a column label, a column number (left to right) or a cell reference.
* The "field" label is not case sensitive. See Example 2.
* If "field" is left blank, then #VALUE! is returned.
* If the "field" column contains some text entries, then these are ignored.
* The "criteria" must include at least one column heading and one cell below the column heading.
* The "criteria" must be in a contiguous block of adjacent cells.
* The "criteria" can be anywhere on the active sheet, although it is recommended not to put it below the data, in case more data is added later on.
* If "criteria" is left blank, then #VALUE! is returned. See Example 19.
* Make sure the "criteria" and "database" ranges do not overlap and that they are always separated by at least one blank row or column.
* To perform an operation on an entire column in a database, enter a blank cell below the column heading in the "criteria" range. See Example 11.
* If more than one value matches the criteria, then #NUM! is returned. See Example 4.
* If no value matches the criteria, then #VALUE! is returned. See Example 14.
* You can use the GETPIVOTDATA function to return the data obtained from a pivot table.
* You can use the VLOOKUP function to return the value in the same row after finding a matching value in the first column.
* You can use the XLOOKUP function to return the value in the same row after finding a matching value in any column.
* This is similar to DAVERAGE, DCOUNT, DMAX, DMIN, DPRODUCT, DSTDEV, DSUM and DVAR functions.
* For the Microsoft documentation refer to support.microsoft.com
* For the Google documentation refer to support.google.com

 ABCD
1=DGET(B1:D10, "Qty", B12:B13) = 19DateQtyCost
2=DGET(B1:D10, "QTY", B12:B13) = 19Jan1918,000
3=DGET(B1:D10, 2, B12:B13) = 19Mar2024,000
4=DGET(B1:D10, "Cost", B12:B14) = #NUM!Feb1716,500
5=DGET(C1:C10, "Qty", C12:C13) = #NUM!Jun2220,000
6=DGET(B1:D10, "Qty", C12:C14) = #NUM! 1819,500
7=DGET(B1:D10, "Cost", C12:D13) = #NUM!Nov2124,000
8=DGET(B1:D10, "Qty", D12:D13) = #NUM!Maytext26,500
9=DGET(B1:D10, "Cost", B12:D14) = 20,000Apr1718,500
10=DGET(B1:D10, "Cost", D16:D17) = #NUM!Mar2429,000
11=DGET(B1:D10, "Cost", C16:D17) = #NUM!   
12=DGET(B1:D10, "Cost", B19:B20) = #NUM!DateQtyCost
13=DGET(B1:D10, "Date", C12:C13) = #NUM!Jan<22>20000
14=DGET(B1:D10, "Qty", B12:D13) = #VALUE!Jun>18 
15=DGET(B1:D10, "text", B12:B13) = #VALUE!   
16=DGET(B1:D10, "Qty", C12) = #VALUE!DateQtyCost
17=DGET(B1:D10, "Cost", C19) = #VALUE!Jun>18 
18=DGET(B1:D10, "Qty", ) = #VALUE!   
19=DGET(B2:D10, "Qty", B12:B13) = #VALUE!Date  
20=DGET(B1:D1, "Qty", B12:B14) = #VALUE!J*  

1 - What is the single "Qty" value when Date="Jan", using a field label. (19)
2 - What is the single "QTY" value when Date="Jan", with the field label in uppercase. (19)
3 - What is the single "Qty" value when Date="Jan", using a field number. (19)
4 - What is the single "Cost" value when Date="Jan" or "Jun". (multiple values)
5 - What is the single "Qty" value when Qty<22. This uses a single column. (multiple values)
6 - What is the single "Qty" value when Qty<22 OR Qty>18. (multiple values)
7 - What is the single "Cost" value when Qty<22 AND Cost>20,000. The Cost for May is not included. (multiple values)
8 - What is the single "Qty" value when Cost>20,000.
9 - What is the single "Cost" value when Date="Jan", Qty<22, Cost>20,000 OR Date="Jun" and Qty>18. (20000)
10 - What is the single "Cost" value for all the items. Putting a blank cell below the column heading will refer to the entire column. (all the numbers)
11 - What is the single "Cost" value when Qty>18 and Cost has no criteria. (multiple values)
12 - What is the single "Cost" value for all the dates that start with the letter "J". (multiple values)
13 - If the "field" column does not contain any numbers, then #NUM! is returned.
14 - If the "criteria" you specify does not return any rows, then #VALUE! is returned. The Cost for January was only 18,000. (no values)
15 - If the "field" does not match one of the column headings, then #VALUE! is returned.
16 - If the "criteria" only includes a column heading, then #VALUE! is returned.
17 - If the "criteria" refers to a single empty cell, then #VALUE! is returned. C19 is empty.
18 - If the "criteria" is left blank, then #VALUE! is returned.
19 - If the "database" range does not include column headings, then #VALUE! is returned.
20 - If the "database" range only includes column headings, then #VALUE! is returned.

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top