top of page

Excel Arena

This is the place, where we can test the boundaries of Excel functions.

List.Distinct to Extract Distinct Values, Lists, Records, Tables

The List.Distinct function allows you to obtain distinct elements from a list. Additionally, it can be applied to extract distinct Lists, Records, and Tables as well.


1. Distinct Values

let

 // 'List' Contains list of Animal Names

 List = Excel.CurrentWorkbook(){[Name="Table3"]}[Content][Animals],

 Result = List.Distinct(List)

in

 Result


2. Distinct Lists

let

 NestedList = { {"Banana", "Apple","Mango"}, {"Orange","Mango"}, {"Banana", "Apple","Mango"} },

 Result = List.Distinct(NestedList)

in

 Result


3. Distinct Lists using equationCriteria

let

 NestedList = { {"Banana", "Apple","Mango"}, {"Orange","Mango"}, {"Banana", "Apple","Mango"} },

 Result = List.Distinct(NestedList, each List.Last(_))

in

 Result


4. Distinct Records

let

 // 'Records' carries list of records

 Records = Table.ToRecords(Excel.CurrentWorkbook(){[Name="Table4"]}[Content]),

 Result = List.Distinct(Records)

in

 Result


5. Distinct Tables

let

 Tbl1 = Excel.CurrentWorkbook(){[Name="Table6"]}[Content],

 Tbl2 = Excel.CurrentWorkbook(){[Name="Table7"]}[Content],

 Result = List.Distinct({Tbl1, Tbl2})

in

 Result

Comments


  • LinkedIn
  • Facebook
  • Twitter
  • Instagram
bottom of page