Find the missing letters in the letter sequence with Power Query

gargamalebarbosa

Board Regular
Joined
Aug 4, 2022
Messages
118
Office Version
  1. 365
Platform
  1. Windows
Hi,
How can i find missing letters in the letter sequence with power query ?

Thank you ,

1683924367072.png
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Extra first and last char from the string. Put in into a list, like {"a".."f"}. They split the string to a list with Text.ToList. finally use List.Difference({first list, secondlist}).
 
Upvote 0
Extra first and last char from the string. Put in into a list, like {"a".."f"}. They split the string to a list with Text.ToList. finally use List.Difference({first list, secondlist}).
Thnak you for answer. I'm not good at M code. I will try, i hope i can do it.
 
Upvote 0
Quick and dirty...
Book1
A
1List
2abcef
3jln
4www
5af
6suwz
7qrst
8filo
Sheet1


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"List", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "As List", each List.Distinct(Text.ToList([List]))),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Full list", each List.Distinct({List.First([As List]).. List.Last([As List])})),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Difference", each Text.Combine(List.Difference([Full list], [As List]), ", "), type text),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom2",{"As List", "Full list"})
in
    #"Removed Columns"

Book1
AB
1ListDifference
2abcefd
3jlnk, m
4www
5afb, c, d, e
6suwzt, v, x, y
7qrst
8filog, h, j, k, m, n
Table1
 
Upvote 0
@GraH Thank you for taking the time to share your knowledge. Last question : We have some special character in our alphabet. Example : ç-ğ-ü-ş
how can ADD them to FULL LIST ?
 
Upvote 0
I found a solution.. but it was not right .

example :It should be like that :

1683968868179.png
 
Last edited:
Upvote 0
It requires an alternative approach.

Power Query:
// List called ABC
= {"a", "b", "c", "ç", "d", "e", "f", "g", "ğ", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "ş", "t", "u", "ü", "v", "w", "x", "y", "z"}

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"List", type text}}),
    String_as_list = Table.AddColumn(#"Changed Type", "As list", each List.Distinct(Text.ToList([List]))),
    Full_list = Table.AddColumn(String_as_list, "Full list", each List.Range(ABC, List.PositionOf(ABC, List.First([As list])), List.PositionOf(ABC, List.Last([As list]))-List.PositionOf(ABC, List.First([As list])))),
    #"Added Custom2" = Table.AddColumn(Full_list, "Difference", each Text.Combine(List.Difference([Full list], [As list]), ", "), type text),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom2",{"As list", "Full list"})
in
    #"Removed Columns"

Book1
IJ
1ListDifference
2abcefç, d
3jlnk, m
4www
5afb, c, ç, d, e
6suwzş, t, ü, v, x, y
7qrstş
8filog, ğ, h, j, k, m, n
Sheet1
 
Upvote 1
Solution
Thank you for your support. And your soution is perfect.
I coudn't add "List call ABC" to query. Is this a new CUMSTOM COLUMN ? How can I add to query ?
Sorry i disturbed you so much.
 
Upvote 0

Forum statistics

Threads
1,223,346
Messages
6,171,566
Members
452,410
Latest member
memote1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top