Others

Find the Minimum Across Multiple Fields in Microsoft Access

Camila MilosovichCamila Milosovich Nov 22, 2026 868 views

Question details

Find the smallest value among several fields or calculated expressions in a single Access record.

Find the Minimum Across Multiple Fields in Microsoft Access
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.
Before you start

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.

Solution 1Recommended

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.

1
Create a standard module

In Access, select Create > Module to open the VBA editor.

2
Add the comparison function

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

3
Add the function to a query

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.

4
Run and check the query

Select Design > Run and check that MinimumValue shows the smallest non-null value for each record.

Use a VBA function to compare values within each Access record
Calculated expressions and VBA security: For calculated columns, use their output names from a saved query or repeat the underlying expressions. Access must allow the database's VBA code to run; enable content only if you trust the database.
Free Microsoft Office alternative

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.

Compare values across a spreadsheet row with the MIN functionOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar interface that makes moving spreadsheet work easierWork with a free, lightweight office suite
microsoft office alternative - wps office

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.