close
標題:

Excel Sorting 問題

發問:

本人用亂數生產器做左1000個sample 每個sample既size係10~~ 即係有1000列x10欄 而家我每一欄要由左至右..將數字由細至大排列 點樣可以一次排晒一千列呀??

免費註冊體驗

 

此文章來自奇摩知識+如有不便請留言告知

最佳解答:

Excel的內建功能, 應該祇有欄排序(直排), 並沒有列排序(橫排) 方法一: 正如樓上所講, 將欄與列的資料倒置, 即用 複製→選擇性貼上→選倒置→確認。但你有1000列, 而Worksheet祇有256欄, 即至少要分4次做倒置。完成倒置後, 再將1000欄逐欄做Highlight排序(即要做1000次), 排完1000欄後, 再做倒置還原成10欄 1000列, 完成。 如認為方法一太麻煩及不切實際, 可考慮以下的方法二(巨集): 按 Alt + F11, →按插入→模組→然後將下面的程式貼上: Sub RowsSort() Dim R As Range For Each R In Selection.Rows R.Sort R.Cells(1), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlLeftToRight, _ SortMethod:=xlStroke, DataOption1:=xlSortNormal Next End Sub 關閉模組視窗, HighLight A1: J1000, 按工具→巨集→巨集→選 RowSort→執行, 祇需1秒鐘, 完成。 因是單列排序, 上述程式內的 OrderCustom, MatchCase, SortMethod, DataOptional1 是可以省去的, 我仍將他們維持在程式內祇是保存VBA 的Sort 函數內引數的完整性, 方便讀者可根據需要來更改程式的內容。 如需由大排至細, 將 xIAscending 改成 xlDescending 如需欄排序, 將xlLeftToRight 改成 xlTopToBottom, 及將 Selection.Rows 改成 Selection.Colunms 2007-02-15 20:01:24 補充: Excel 的排序功能, 每次祇排一行(即條件一), 其他行數是不會從頭到尾排序。

其他解答:

Excel的排序方向可遁欄或遁列排序, Excel的default排序方向是遁欄, 但你可在排序對話框內的左下角按[選項], 再選遁列排序, 按[確定]後便可以一次排一千或更多列.|||||If I understand the question right, 列 is row (horizontal) and 欄 is column (veticle). The you can sort your data in this arrangement so easily by sort to each column individually. Under Data>Sort>Ascending. If not and 列 should be column and 欄 is row. You can hightlight your data set, copy and paste special to a new area/sheet, pick Transpose at the bottom. Your data is not change to the same format as above. Then follow the steps above. When it is done, copy, paste special and transpse again to restore to the orignal format. It is a very good technique in Excel for you can have more rows than columns. I hope it works. Good luck.|||||先按資料,選擇排序便可
arrow
arrow

    gpjqem1 發表在 痞客邦 留言(0) 人氣()