List.Min Function in Power Query M

Sumit Bansal
Written by

Sumit Bansal is the founder of TrumpExcel.com and a 13-time Microsoft Excel MVP. He started this site in 2013 to share his passion for Excel through easy tutorials, tips, and training videos, helping you master Excel, boost productivity, and maybe even enjoy spreadsheets!

The List.Min function in Power Query returns the smallest value in a list, like the lowest price, the earliest date, or the fastest time. It skips null values by default, so blank cells in your data don’t get in the way.

You can use it on a whole column, across the cells of one row, or on each group in a table. Its optional arguments decide what happens with blanks and empty lists.

Follow along with the example file

List.Min Function Examples.xlsx

Download

List.Min Function Syntax

List.Min(list as list, optional default as any, optional comparisonCriteria as any, optional includeNulls as nullable logical) as any
  • list – the list you want the smallest value from. It can be a list you type in curly brackets, such as {10,20,30}, or a column of a table.
  • default (optional) – the value to return when the list is empty or holds only nulls. If you leave it out, you get null.
  • comparisonCriteria (optional) – decides how the items are compared, for example ignoring upper and lower case in text. Leave it out (or use null) for the normal comparison.
  • includeNulls (optional) – set it to true to count null values, which makes null the result whenever the list has one. Leave it out (or use false) and nulls are skipped.

What it returns: The smallest item in the list, with the same data type as the items. So a list of numbers returns a number, and a list of dates returns a date.

The List.Min function is part of the Power Query M language, so it works wherever Power Query does in Excel: Excel 365, 2024, 2021, 2019, and 2016 for Windows, and Excel for Microsoft 365 on Mac.

When to Use the List.Min Function

Use this function when you need to:

  • Find the lowest number in a column, like the cheapest price
  • Get the earliest date from a column of dates
  • Add a column with the lowest value across several columns in each row
  • Keep the rows that hold the lowest value, including ties
  • Get the lowest value for each group (each product, region, or customer)
  • Find the lowest value while ignoring zeros

Example 1: Find the Smallest Number in a List

Let’s start with the simplest use. Suppose you have the daily low temperatures for a week (14, 9, 11, 6, 12, 8, and 10), and you want the coldest one.

In Excel, go to Data > Get Data > From Other Sources > Blank Query. In the Power Query Editor that opens, type this formula in the formula bar:

= List.Min({14,9,11,6,12,8,10})

Result: 6

List.Min returns 6, the lowest of the seven temperatures

Here, the curly brackets create a list of seven numbers, and List.Min returns the smallest one, which is 6.

In real work, the list usually comes from your data instead of being typed in. The examples below show the common ways to get that list from a table.

In the example file, Example 1 types its numbers right into the query, so it doesn’t have a sheet. You can open it from Data > Queries & Connections.

Example 2: Find the Lowest Value in a Column

Here’s the most common use of List.Min. Below is a table named HotelRates with the nightly rate of six hotels, and I want the lowest rate as a single number.

HotelRates table with the nightly rate of six hotels

In the code below, the Source line uses the Excel.CurrentWorkbook function to pull the HotelRates table into Power Query by its name.

If you try this on your own data, format it as a table (Ctrl + T) and put your table’s name in place of “HotelRates”.

Create a new blank query (as in Example 1), open the Advanced Editor (Home > Advanced Editor), and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="HotelRates"]}[Content],
Lowest = List.Min(Source[Nightly Rate])
in
Lowest

Result: 137

List.Min on the Nightly Rate column returns the lowest rate, 137

Here, Source is the name of the first step, and it holds the HotelRates table. Source[Nightly Rate] takes the Nightly Rate column of that table and returns it as a list, and List.Min returns the smallest value in it, 137 (Cedar Point Hotel).

So whenever you want the lowest value in a column, put the step name, followed by the column name in square brackets, inside List.Min.

If you want the highest value instead, the List.Max function works the same way and returns the highest value.

Example 3: Get the Earliest Date

List.Min works on dates too, where the smallest date is the earliest one. Below is a table named Subscriptions with the date each software subscription renews, and I want the earliest renewal date.

Subscriptions table with the date each software subscription renews

Dates from an Excel table come into Power Query as date and time values. So the code first changes the Renews On column to the date type, so the result is a plain date.

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="Subscriptions"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Renews On",type date}}),
Earliest = List.Min(#"Changed Type"[Renews On])
in
Earliest

Result: 2/14/2026

List.Min on the Renews On column returns the earliest date, 2/14/2026

Here, the Changed Type step sets Renews On as a date column. Then #"Changed Type"[Renews On] takes that column as a list, and List.Min returns the earliest date, 2/14/2026 (Cloud Storage).

The date shows in your computer’s regional date format, so it may look different on your screen. It’s the same date either way.

Example 4: Find the Lowest Value in Each Row

Now let’s look across a row instead of down a column. Below is a table named SwimHeats with each swimmer’s time (in seconds) in three heats, and I want each swimmer’s best time in a new Best Time column.

SwimHeats table with three heat times per swimmer and two missed heats

Two swimmers missed a heat, so those cells are blank. In Power Query, blank cells come in as null.

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="SwimHeats"]}[Content],
#"Added Best Time" = Table.AddColumn(Source,"Best Time",each List.Min({[Heat 1],[Heat 2],[Heat 3]}),type number)
in
#"Added Best Time"

Result: A new Best Time column (30.87, 31.74, 29.88, 32.48, and 30.66)

A new Best Time column with each swimmer's lowest time, skipping the blank heats

Here, the Table.AddColumn function adds a Best Time column and runs the formula after each once for every row. For each row, {[Heat 1],[Heat 2],[Heat 3]} builds a list of that swimmer’s three times, and List.Min returns the lowest.

Elaine Hamilton missed Heat 2, so her list is {32.06, null, 31.74}. List.Min skips the null and returns 31.74, her best time from the heats she swam.

If all three heats were blank, the list would hold only nulls, and List.Min would return null for that row.

Example 5: Return Null When a Value Is Missing (includeNulls)

In Example 4, the blanks were skipped. But sometimes a blank means the data isn’t complete yet, and you don’t want a result until every value is in.

Let’s use the same SwimHeats table (on the Example 4 sheet of the example file). Suppose you only want a best time for swimmers who swam all three heats.

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="SwimHeats"]}[Content],
#"Added Best Time All Heats" = Table.AddColumn(Source,"Best Time (All Heats)",each List.Min({[Heat 1],[Heat 2],[Heat 3]},null,null,true),type number)
in
#"Added Best Time All Heats"

Result: A new Best Time (All Heats) column where Elaine Hamilton and Meredith Sullivan show null (30.87, null, 29.88, 32.48, and null)

With includeNulls set to true, swimmers with a missed heat get null

Here, the fourth argument, true, is the includeNulls setting. It tells List.Min to count nulls, and a null counts as smaller than any number, so any row with a blank heat returns null.

The two nulls in the middle are the default and comparisonCriteria arguments. You need them as placeholders so that true lands in the fourth position.

The other three swimmers swam every heat, so they get the same best time as in Example 4. The null rows are easy to spot, or to filter out, until the missing times come in.

Follow along with the example file

List.Min Function Examples.xlsx

Download

Example 6: Keep the Rows With the Lowest Value

Often you want more than the lowest value, because you also want to know which row it came from.

Below is a table named InternetPlans with the monthly price of five internet plans, and I want the row (or rows) with the cheapest price.

InternetPlans table with the speed and monthly price of five plans

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="InternetPlans"]}[Content],
Lowest = List.Min(Source[Monthly Price]),
Cheapest = Table.SelectRows(Source,each [Monthly Price] = Lowest)
in
Cheapest

Result: A table with two rows, Northwave (500 Mbps, 49) and CityNet (200 Mbps, 49)

Both plans tied at the lowest price of 49 are kept

Here, the Lowest step finds the lowest monthly price, which is 49. Then the Table.SelectRows function keeps only the rows where Monthly Price equals 49.

Two plans cost 49, so both rows come back. That’s the advantage of this approach, because a tie for the lowest price doesn’t hide one of the plans.

If you only ever need one row, the Table.Min function returns a single row with the lowest value in a column.

Example 7: Return a Default Value When Nothing Matches

This one uses the optional second argument. Below is a table named RentalListings with apartments for rent in three cities, and I want the lowest rent for a 3-bedroom apartment in Austin.

RentalListings table with apartments for rent in Austin, Denver and Tampa

There are no 3-bedroom listings in Austin, so the list List.Min gets is empty. Without a default, the result would be null, which isn’t clear to someone reading the result.

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="RentalListings"]}[Content],
Filtered = Table.SelectRows(Source,each [City] = "Austin" and [Bedrooms] = 3),
Lowest = List.Min(Filtered[Monthly Rent],"No listings")
in
Lowest

Result: No listings

No 3-bedroom listing in Austin, so List.Min returns the default, No listings

Here, the Filtered step keeps only the rows where City is “Austin” and Bedrooms is 3. No row matches, so Filtered[Monthly Rent] is an empty list, and List.Min returns the default, “No listings”.

If you change the condition to [Bedrooms] = 2, the list has one rent (1890), and List.Min returns 1890 as usual. The default is used only when there’s nothing to compare.

The default is also used when every matching row has a blank rent. List.Min skips the nulls and has nothing left to compare, so you see “No listings” instead of null.

A text default like “No listings” is good for a result people read. If a later step does math with the result, use a number as the default instead, because a text value there gives an error.

Example 8: Find the Lowest Value Other Than Zero

This next one comes up a lot with real data. Below is a table named BranchLoans with the number of books each library branch loaned last month, and I want the lowest number among the branches that were open.

BranchLoans table with books loaned per branch and two closed branches at 0

Hillside and Northfield were closed for repairs, so they show 0. If you use List.Min on the whole column, you get 0, which doesn’t tell you anything useful.

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="BranchLoans"]}[Content],
Lowest = List.Min(List.Select(Source[Books Loaned],each _ > 0))
in
Lowest

Result: 788

Ignoring the zeros, the lowest number of books loaned is 788

Here, the List.Select function keeps only the values greater than 0. In each _ > 0, the underscore (_) stands for each value in the list.

That leaves 1840, 926, 1213, and 788, and List.Min returns 788 (Westgate).

Example 9: Get the Lowest Value for Each Group

This is where List.Min is used a lot. Below is a table named PurchaseOrders with the unit cost paid for three products across several orders, and I want the lowest cost paid for each product in a Lowest Cost column.

PurchaseOrders table with the unit cost paid for three products

Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="PurchaseOrders"]}[Content],
Grouped = Table.Group(Source,{"Product"},{{"Lowest Cost",each List.Min([Unit Cost]),type number}})
in
Grouped

Result: One row per product with its Lowest Cost (Printer Paper 4.65, Toner Cartridge 58.95, and Desk Lamp 18.75)

Table.Group with List.Min gives the lowest unit cost for each product

Here, the Table.Group function groups the rows by Product. For each product, [Unit Cost] is the list of costs from that product’s rows only, and List.Min returns the smallest.

For example, Printer Paper was bought at 4.85, 4.65, and 5.15, so its lowest cost is 4.65.

The type number at the end sets the new column’s data type to number. If you use the Group By button (Home > Group By) with the Min operation, Power Query writes a List.Min step like this for you.

Example 10: Find the Lowest Number Stored as Text

This last one is a common problem with data that comes from other systems. Below is a table named BikeParts with the price of four parts, where the prices are stored as text, and I want the lowest price.

BikeParts table where the Price column holds numbers stored as text

Here’s what happens if you use List.Min on the Price column as it is. Create a new blank query, open the Advanced Editor, and use this code:

let
Source = Excel.CurrentWorkbook(){[Name="BikeParts"]}[Content],
Lowest = List.Min(Source[Price])
in
Lowest

Result: 1250

On text prices, List.Min returns 1250 instead of the real lowest price

The lowest price is 899, but List.Min returns 1250. Because the prices are text, List.Min compares them character by character, like words in a dictionary, and “1250” comes before “899” because 1 comes before 8.

List.Min doesn’t give an error here, so this is easy to miss. To fix it, change the Price column to numbers before you use List.Min:

let
Source = Excel.CurrentWorkbook(){[Name="BikeParts"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Price",type number}}),
Lowest = List.Min(#"Changed Type"[Price])
in
Lowest

Result: 899

After changing Price to numbers, List.Min returns 899

Here, the Changed Type step turns the Price column into numbers. Now List.Min compares them as numbers and returns 899 (Groupset).

You can also change the type without code. Before you add the List.Min step, right-click the Price header and choose Change Type > Decimal Number.

Power Query adds a step named Changed Type. The List.Min step you add after it can then use #"Changed Type"[Price], like the code above.

Other Excel Articles You May Also Like:

  • List.First – Use List.First in Power Query M to get the first item in a list.
  • Table.Max – Use Table.Max in Power Query M to get the row with the largest value.
  • List.IsEmpty – Use List.IsEmpty in Power Query M to check whether a list has values or is empty.
  • List.FirstN – Use List.FirstN in Power Query M to get the first items of a list.
  • List.Sort – Use List.Sort in Power Query M to sort a list.
  • List.Distinct – Use List.Distinct in Power Query M to remove duplicates from a list.
  • List.Difference – Use List.Difference in Power Query M to find items in one list but not another.
  • List.MatchesAny – Use List.MatchesAny in Power Query M to check if any item meets a condition.

All Power Query Functions

Sumit Bansal

Sumit Bansal

13x Microsoft Excel MVP

Hey! I'm Sumit Bansal, founder of trumpexcel.com and a Microsoft Excel MVP. I started this site in 2013 because I genuinely love Microsoft Excel (yes, really!) and wanted to share that passion through easy Excel tutorials, tips, and Excel training videos. My goal is straightforward: help you master Excel skills so you can work smarter, boost productivity, and maybe even enjoy spreadsheets along the way!

Get the FREE 51 Excel Tips Ebook

Enter your details and the free PDF is on its way to your inbox.

Hmm, that didn't go through. Please check your email and try again.

No spam. You'll also get my weekly Excel newsletter. Unsubscribe anytime.

Check your inbox!

The ebook is on its way to your email. It usually lands within a couple of minutes.