I have a column containing numbers and text together that I want to sort in Power Query. I want the sort to mimic the sort order that Excel would use if I sorted and chose "Sort numbers and numbers stored as text separately."
For example, I have the following values
[TABLE="class: grid, width: 93"]
<tbody>[TR]
[TD]Value[/TD]
[/TR]
[TR]
[TD]#750[/TD]
[/TR]
[TR]
[TD]#770[/TD]
[/TR]
[TR]
[TD]#8[/TD]
[/TR]
[TR]
[TD]#9[/TD]
[/TR]
[TR]
[TD]000.000.01001[/TD]
[/TR]
[TR]
[TD]000.000.01003[/TD]
[/TR]
[TR]
[TD]000.000.01004[/TD]
[/TR]
[TR]
[TD]000.000.01005[/TD]
[/TR]
[TR]
[TD]000-001[/TD]
[/TR]
[TR]
[TD]000-0030[/TD]
[/TR]
[TR]
[TD]000-0049-00[/TD]
[/TR]
[TR]
[TD]001[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
Note that the 001 at the bottom is a text value, not number.
When sorted in Excel, the list sorts as shown above. But if I load this table to PQ, sort, and load back to the worksheet, I get this
[TABLE="class: grid, width: 93"]
<tbody>[TR]
[TD]Value[/TD]
[/TR]
[TR]
[TD]#750[/TD]
[/TR]
[TR]
[TD]#770[/TD]
[/TR]
[TR]
[TD]#8[/TD]
[/TR]
[TR]
[TD]#9[/TD]
[/TR]
[TR]
[TD]000-001[/TD]
[/TR]
[TR]
[TD]000-0030[/TD]
[/TR]
[TR]
[TD]000-0049-00[/TD]
[/TR]
[TR]
[TD]000.000.01001[/TD]
[/TR]
[TR]
[TD]000.000.01003[/TD]
[/TR]
[TR]
[TD]000.000.01004[/TD]
[/TR]
[TR]
[TD]000.000.01005[/TD]
[/TR]
[TR]
[TD]001[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
The records in red have moved from the PQ sort.
I need the sort to be consistent with Excel's sort so I can use a MATCH formula with the sort criteria as being '1.'
For example, I have the following values
[TABLE="class: grid, width: 93"]
<tbody>[TR]
[TD]Value[/TD]
[/TR]
[TR]
[TD]#750[/TD]
[/TR]
[TR]
[TD]#770[/TD]
[/TR]
[TR]
[TD]#8[/TD]
[/TR]
[TR]
[TD]#9[/TD]
[/TR]
[TR]
[TD]000.000.01001[/TD]
[/TR]
[TR]
[TD]000.000.01003[/TD]
[/TR]
[TR]
[TD]000.000.01004[/TD]
[/TR]
[TR]
[TD]000.000.01005[/TD]
[/TR]
[TR]
[TD]000-001[/TD]
[/TR]
[TR]
[TD]000-0030[/TD]
[/TR]
[TR]
[TD]000-0049-00[/TD]
[/TR]
[TR]
[TD]001[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
Note that the 001 at the bottom is a text value, not number.
When sorted in Excel, the list sorts as shown above. But if I load this table to PQ, sort, and load back to the worksheet, I get this
[TABLE="class: grid, width: 93"]
<tbody>[TR]
[TD]Value[/TD]
[/TR]
[TR]
[TD]#750[/TD]
[/TR]
[TR]
[TD]#770[/TD]
[/TR]
[TR]
[TD]#8[/TD]
[/TR]
[TR]
[TD]#9[/TD]
[/TR]
[TR]
[TD]000-001[/TD]
[/TR]
[TR]
[TD]000-0030[/TD]
[/TR]
[TR]
[TD]000-0049-00[/TD]
[/TR]
[TR]
[TD]000.000.01001[/TD]
[/TR]
[TR]
[TD]000.000.01003[/TD]
[/TR]
[TR]
[TD]000.000.01004[/TD]
[/TR]
[TR]
[TD]000.000.01005[/TD]
[/TR]
[TR]
[TD]001[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]
The records in red have moved from the PQ sort.
I need the sort to be consistent with Excel's sort so I can use a MATCH formula with the sort criteria as being '1.'