I am trying to enter approximately 190 txt datafiles in Excel using the New Query tool (Data->New Query->From File->From Folder). In the Windows explorer the data are properly ordered: the first being 0summary, the second 30summary etc.
However, when entering them through the query tool the files are sorted as shown in the picture (see line 9 for example, you will see that the file is not in the right position):
The files are sorted based on the first digit instead of the value represented. Is there a solution to this issue? I have tried putting space between the number and the summary but it also didn't work. I saw online that Excel doesn't recognize the text within "" or after /, but I am not allowed to save the text files with those symbols in their name in Windows. Even when removed the word summary the problem didn't fix. Any suggestions?
答案 0 :(得分:1)
If all your names include the word Summary:
You can add a column "Extract" / "Text before delimiter" enter "Summary", change the column type to Number and sort over that column
答案 1 :(得分:0)
如果唯一的数字是您希望排序的数字,则可以
whole number
自定义列的公式:
Text.Select([Name],{"0".."9"})
如果alpha部分有所不同,并且您还需要对其进行排序,则可以执行类似的操作,为alpha部分添加另一列,然后对其进行排序。
如果要排序的前导数字后面可能有数字,则对添加的列使用以下公式,该公式将仅提取文件名开头的数字:
=Text.Middle([Name],0,Text.PositionOfAny([Name],{"A".."z"}))