let
Source = Excel.CurrentWorkbook(){[Name="Table4"]}[Content],
Text = Table.TransformColumnTypes(Source,{{"Serial #", type text}, {"Townid", type text}}),
Three = Table.AddColumn(Text, "Custom", each Text.Start([#"Serial #"],3)),
Join = Table.NestedJoin(Three,{"Townid"},Three,{"Custom"},"Table",JoinKind.Inner),
Expand = Table.ExpandTableColumn(Join, "Table", {"MyUniq"}, {"MyUniq.1"}),
RC = Table.RemoveColumns(Expand,{"Custom"}),
Reorder = Table.ReorderColumns(RC,{"Serial #", "MyUniq", "Townid", "MyUniq.1"}),
Ren = Table.RenameColumns(Reorder,{{"MyUniq", "Result"}, {"MyUniq.1", "MyUniq"}})
in
Ren