- Joined
- Mar 21, 2011
- Messages
- 1,953
- Reaction score
- 0
- Points
- 36
- Excel Version(s)
- O365
I am trying to build a list of lists from data in an Excel cell (it is multiple sort criteria). I am supposing to put data similar to this in the cell
Column1,0,Column2,0,Column3,0
and my query will split that into a list of lists that I can use in a sort, such as this
columns.sort = Table.Sort(nulls.remove, columns.sortorder),
1. If I create a simple list of lists in PQ that can be fed to the sort it works fine, example
columns.sortorder = {{"Company",0},{"FOOH or Union",0},{"Area-Union Code",0}},
2. If I try and use a test string and split it to feed to the sort I get invalid sort criteria, example
columns.sortorder = List.Split(Text.Split("Company,0,FOOH or Union,0,Area-Union Code,0", ","), 2),
3. I can create a list of lists from the Excel cell to feed to the sort but this also gives invalid sort criteria, example
columns.sortorder = List.Split(Text.Split(Excel.CurrentWorkbook(){[Name="tblTableParameters"]}[Content]{0}[SortBy], ","), 2),
As far as I can tell, the list of list in all 3 of the above are identical, but #1 works in the sort, #2 and #3 do not work.
Can anyone see what I need to do to get this to work, or suggest another approach (I can't have multiple cells, it must all be in one cell).
TIA
Column1,0,Column2,0,Column3,0
and my query will split that into a list of lists that I can use in a sort, such as this
columns.sort = Table.Sort(nulls.remove, columns.sortorder),
1. If I create a simple list of lists in PQ that can be fed to the sort it works fine, example
columns.sortorder = {{"Company",0},{"FOOH or Union",0},{"Area-Union Code",0}},
2. If I try and use a test string and split it to feed to the sort I get invalid sort criteria, example
columns.sortorder = List.Split(Text.Split("Company,0,FOOH or Union,0,Area-Union Code,0", ","), 2),
3. I can create a list of lists from the Excel cell to feed to the sort but this also gives invalid sort criteria, example
columns.sortorder = List.Split(Text.Split(Excel.CurrentWorkbook(){[Name="tblTableParameters"]}[Content]{0}[SortBy], ","), 2),
As far as I can tell, the list of list in all 3 of the above are identical, but #1 works in the sort, #2 and #3 do not work.
Can anyone see what I need to do to get this to work, or suggest another approach (I can't have multiple cells, it must all be in one cell).
TIA
Last edited: