One of the best features of Excel is that it's quick and easy to sort columns of data

You can even sort data in an Excel row, left to right, by changing one of the sort options.
您甚至可以通过更改排序选项之一,在Excel行中从左到右对数据进行排序。

用公式对多行数据进行排序 (Sort Multiple Rows of Data With a Formula)
In a comment on the Sort a Row in Excel 2010 blog post, Debbie asked about sorting 2000 rows, left to right. She didn't say they were lottery numbers, but her example, shown below, sure looks like that to me.
在对Excel 2010中的“排序行”博客文章的评论中,黛比询问从左至右对2000行进行排序。 她没有说他们是彩票号码,但是下面显示的她的例子对我来说确实像那样。

One way to sort the rows is to use a formula, in columns to the right. In the screen shot below, cells H1:M1 are selected, and this SMALL formula is entered:
对行进行排序的一种方法是使用右侧列中的公式。 在下面的屏幕快照中,选择了单元格H1:M1,并输入了这个小公式:
=SMALL(A1:F1,{1,2,3,4,5,6})
= SMALL(A1:F1,{1,2,3,4,5,6})
Then, to array-enter the formula, press Ctrl+Shift+Enter
然后,要数组输入公式,请按Ctrl + Shift + Enter

Then, copy the formula down to the last row of numbers, to see all the rows in ascending order.
然后,将公式复制到数字的最后一行,以按升序查看所有行。

As a final step, you could copy the columns of formulas, and paste them as values.
最后,您可以复制公式的列,并将其粘贴为值。
用宏对多行进行排序 (Sort Multiple Rows with a Macro)
If you don't want to mess with formulas, you could use a macro to sort each row, left to right. This macro, from Dave Peterson, will sort all the rows on the active sheet, starting in row 1, and assumes there are 6 columns of numbers.
如果您不想弄乱公式,可以使用宏从左到右对每一行进行排序。 来自戴夫·彼得森(Dave Peterson)的此宏将对活动工作表上的所有行(从第1行开始)进行排序,并假定有6列数字。
Make a copy of your original worksheet, before sorting with the macro.
在对宏进行排序之前,请复制原始工作表。
Sub SortLotteryRows()
'posted by Dave Peterson
Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long
With ActiveSheet
FirstRow = 1 'change to 2 if there are headings
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For iRow = FirstRow To LastRow
With .Cells(iRow, "A").Resize(1, 6)
.Sort Key1:=.Columns(1), _
Order1:=xlAscending, _
Header:=xlNo, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlLeftToRight
End With
Next iRow
End With
End Sub
其他行排序思路 (Other Row Sorting Ideas)
Do you have any other ideas for sorting lots of rows? Please share your ideas in the comments. _____________
您还有其他想法来对很多行进行排序吗? 请在评论中分享您的想法。 ______________
翻译自: https://contexturesblog.com/archives/2011/10/28/sort-lottery-number-rows-in-excel/