Sorting values with formula, in a weird way.

Badgerfh

New Member
Joined
Jun 14, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello and I'm in need of some help
Not sure how to word it to make sense, som I'm doing it with an example.


Below is my data set, they are independent of each other, as in different lengths and locations.

Model grp.ModelUnique idPrt.lst.Model grp.
1abRed1ab1aa 1ab bb1ab
1abBlue1ab2aa 1ab bb1ab
1abGreen1ab3aa 1ab bb1ab
2abBlue2abaa 2ab bb2ab
3abRed3ab1aa 3ab bb3ab
3abOrange3ab2aa 3ab bb3ab

And this is what I want my final list to look like.

Prt.lst.Model grpModel
aa 1ab bb1abRed
aa 1ab bb1abBlue
aa 1ab bb1abGreen
aa 2ab bb2abBlue
aa 3ab bb3abRed
aa 3ab bb3abOrange

Is there any hope to get this to work?

Sorry if vague description, happy to provide more info if it helps, just don't know what I'd need to say
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Bring each table into Power Query which is called Get and Transform Data in O365. Once there create a join. Mcodes for each follows

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Model grp.", type text}, {"Model", type text}, {"Unique id", type text}})
in
    #"Changed Type"

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Prt.lst.", type text}, {"Model grp.", type text}})
in
    #"Changed Type"

Power Query:
let
    Source = Table.NestedJoin(Table2, {"Model grp."}, Table1, {"Model grp."}, "Table1", JoinKind.LeftOuter),
    #"Expanded Table1" = Table.ExpandTableColumn(Source, "Table1", {"Model"}, {"Table1.Model"}),
    #"Removed Duplicates" = Table.Distinct(#"Expanded Table1")
in
    #"Removed Duplicates"

Book8
ABCDEF
1Model grp.ModelUnique idPrt.lst.Model grp.
21abRed1ab1aa 1ab bb1ab
31abBlue1ab2aa 1ab bb1ab
41abGreen1ab3aa 1ab bb1ab
52abBlue2abaa 2ab bb2ab
63abRed3ab1aa 3ab bb3ab
73abOrange3ab2aa 3ab bb3ab
8
9
10Prt.lst.Model grp.Table1.Model
11aa 1ab bb1abRed
12aa 1ab bb1abBlue
13aa 1ab bb1abGreen
14aa 2ab bb2abBlue
15aa 3ab bb3abRed
16aa 3ab bb3abOrange
Sheet1
 
Upvote 0
Solution
Thanks a lot for the help, and for the quick reply, it got me looking into Power Query.

I got it working, I didn't know about Power Query before, but have scraped on the surface of it now.
The link on the end of the forum "Power Query Examples" helped more I think than the M code snips tho 😅
 
Upvote 0

Forum statistics

Threads
1,224,620
Messages
6,179,928
Members
452,949
Latest member
beartooth91

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