Skip to main content

MINBY

Returns the object with the minimum value of a specified property.

Syntax​

MINBY(array, property)

Arguments​

  • array: The array or collection to iterate over.
  • property: The property name to compare values by.

Example​

MINBY(A1:A5, "value") → Returns the object in the range A1:A5 with the minimum value for the "value" property.
MINBY([{value: 10, id: 1}, {value: 5, id: 2}, {value: 15, id: 3}], "value") → Returns {value: 5, id: 2}.

Usage Notes:

  • If multiple objects have the same minimum value, the first one encountered is returned.
  • Objects missing the specified property are skipped when comparing, the same way MAXBY skips them.
  • If the array is empty, or no object has the specified property, the function returns undefined.
  • The function assumes that the property values are comparable (e.g., numbers or strings).
  • See also MAXBY, which returns the object with the maximum value instead.