The DBMax function returns the largest value from a column in a table. The rows that are compared can be limited by applying a filter
This function can be added to your worksheet by using the Function Wizard.
DBMax( connection , table , column , filter , [ parameter1 ] , [ ...parameter n ])
The DBMax function syntax has these parts:
|Required. This argument identifies the connection name used to connect to the database.
|Required. This argument identifies an SQL statement or a specific internal table name in the database. If this argument does not supply a valid source of data, then the result of the function will be #TABLE? ("table name" not found).
|Required. This argument identifies an internal field name or alias returned by the table name argument. If this argument does not contain a valid field name, then the result of the function will be #FIELD? ("field name" not found).
|Optional. A filter is a string of text that includes comparisons between fields in the table and specific values as a literal value or a parameter. Parameters to a cell reference are indicated by using a question mark placeholder within the filter string. The function will evaluate the question mark placeholder with the corresponding parameter. Only the records that satisfy the filter conditions will be used to return values.
|parameter 1 , [ ...parameter n ]
|Required if filter uses placeholders. This is a comma-delimited list of values or cell references used to replace the corresponding question mark placeholders within the filter string. Parameter 1 is used for the first question mark placeholder in the filter, Parameter 2 would represent the second question mark placeholder, and so on.
Returns the last due date for the invoices for the vendor specified in cell A5.
=DBMax("Sage 100 Contractor", "acpinv", "duedte", "vndnum=?", $A5)