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

Recent Posts

See All
Recursion in Excel and Power Query

In this post, I will demonstrate recursion in Excel and Power Query with some basic examples. Example 1: You are on a set of stairs that...

 
 
 

Comments


  • Facebook
  • Twitter
  • LinkedIn

©2022 by Excel with Excel. Proudly created with Wix.com

bottom of page