Database function in excel had definied to the following Function :
- DAVERAGE Returns the average of selected database entries
- DCOUNT Counts the cells that contain numbers in a database
- DCOUNTA Counts nonblank cells in a database
- DGET Extracts from a database a single record that matches the specified criteria
- DMAX Returns the maximum value from selected database entries
- DMIN Returns the minimum value from selected database entries
- DPRODUCT Multiplies the values in a particular field of records that match the criteria in a database
- DSTDEV Estimates the standard deviation based on a sample of selected database entries
- DSTDEVP Calculates the standard deviation based on the entire population of selected database entries
- DSUM Adds the numbers in the field column of records in the database that match the criteria
- DVAR Estimates variance based on a sample from selected database entries
- DVARP Calculates variance based on the entire population of selected database entries
In This Sections, we will try to create macro for DSUM, DMIN dan DMAX function. Now, open your macro in your microsoft excel work, create module and insert code below :
Function JMin(data, Field, citeria) As Double
JMin = Excel.WorksheetFunction.DMin(data, Field, citeria)
End Function
Function JMax(data As Range, Field As String, citeria As Range) As Double
JMax = Excel.WorksheetFunction.DMax(data, Field, citeria)
End Function
Function JSum(data As Range, Field As String, citeria As Range) As Double
JSum = Excel.WorksheetFunction.DSum(data, Field, citeria)
End Function

In your worksheets, the maro will work like this :

JMin, this function looks at the records of the minimum profit of apple trees over 12 in height.
JMax, this function looks at the records of the maximum profit of apple trees over 12 in height.
JSum, this function looks total profit from apple trees at all.













