Search code examples
ms-accessformattingconditional-statementsdatasheet

Find minimum value in row on datasheet


I want to highlight the column with the minimum value. To achieve that i want to use conditional formating with the following formular:

In Column i
Hightlight cell if following function is true:
[date i] <= Minimum([date1],[date2],[date3],[date4])

This formular doesn't work. The Function min() finds the minimum value of a column. I need a Function that gets multiple values of a row and returns the minimal value.

I know that i could do something like

[date i] <= [date1] and [date i] <= [date2] and [date i] <= [date3] and [date i] <= [date4]

but it wouldn't be clean code.

Picture of the according menu in Access


Solution

  • Options:

    1. UNION query to rearrange the fields into normalized structure then use the UNION query in an aggregate query with the Min() function

    2. VBA custom function