Find the Minimum Across Multiple Fields in Microsoft Access
Question details
Find the smallest value among several fields or calculated expressions in a single Access record.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A query produces several level values for each promotion, and the user needs the minimum across those values in each record.
- Observed behavior
- The SQL Min aggregate evaluates one expression across rows rather than comparing several expressions within the same row.
Identify the numeric fields or calculated expressions to compare and decide how null values should be handled. If the values are calculated in a query, save that query first so its output fields can be used in another query.
Use a VBA function to compare values within each Access record
Use this approach when the values already exist in separate fields or calculated query columns.
The function below ignores Null values and returns Null if every supplied value is Null. Use it with numeric values.
In Access, select Create > Module to open the VBA editor.
Paste this code into the module, then save it with a name such as modValueFunctions: Public Function MinOfList(ParamArray Values() As Variant) As Variant Dim v As Variant Dim result As Variant result = Null For Each v In Values If Not IsNull(v) Then If IsNull(result) Then result = v ElseIf v < result Then result = v End If End If Next v MinOfList = result End Function
Open your table or saved query in Query Design. In an empty Field column, enter MinimumValue: MinOfList([Level1], [Level2], [Level3]), replacing the example field names with your own.
Select Design > Run and check that MinimumValue shows the smallest non-null value for each record.

Store level values as related rows and use SQL Min
Use this approach when you can redesign the data structure and want standard aggregation across levels.
Compare exported Access values in WPS Spreadsheets
WPS Office is a free, lightweight alternative for working with exported data in a familiar spreadsheet interface. Export Access query results to Excel, open them in WPS Spreadsheets, and use MIN across cells in each row. WPS does not fix Access queries or run Access databases.

Frequently Asked Questions
Why doesn't Access SQL Min compare several fields in one row?
Min is an aggregate that evaluates one expression across records in a group. To compare separate values in one record, use a function such as MinOfList or restructure the values as related rows.
Can I use MinOfList with calculated query columns?
Yes. Save the query containing the calculated columns, then create another query based on it and call MinOfList with the saved query's output field names.
What happens if one of the values is Null?
The MinOfList function shown here skips Null values. If all supplied values are Null, it returns Null.
Can I compare the values in WPS Spreadsheets instead?
Yes. Export the Access query results to an Excel file, open it in WPS Spreadsheets, and enter a formula such as =MIN(B2:D2) for the values in a row. This does not change the original Access query.




