c# excel 数据排序_在Excel中对数据进行安全排序

c# excel 数据排序

It seems simple enough, but sorting data in Excel can go horribly wrong, if you aren't careful. For example, you could sort a list of names, but miss the phone numbers in a nearby column. When you're finished, all the names are associated with the wrong phone number.

看起来很简单,但是如果不小心,在Excel中对数据进行排序可能会出错。 例如,您可以对名称列表进行排序,但是会错过附近一列中的电话号码。 完成后,所有名称都与错误的电话号码相关联。

Here are some tips for trouble free sorting:

以下是无故障排序的一些提示:

  • Make a backup copy of your file before you sort the list. If there are problems with the sorted list, you can use a copy of your backup file instead.

    在对列表进行排序之前,请先备份文件 。 如果排序后的列表有问题,则可以使用备份文件的副本。

  • Save the file before you sort the list. Then, if the list get scrambled, you can close the list without saving it again.

    在对列表进行排序之前,请保存文件 。 然后,如果列表混乱,您可以关闭列表而无需再次保存。

  • Before you sort, select all the cells in the list. This is the safest approach to sorting. In most cases, you can select one cell and Excel will correctly detect the rest of the list -- but not always. If there are blank rows or columns, some of the data may not be included in the sort, and the list will be scrambled.

    排序之前,请选择列表中的所有单元格 。 这是最安全的分类方法。 在大多数情况下,您可以选择一个单元格,Excel会正确检测列表的其余部分-但并非总是如此。 如果行或列为空白,则排序中可能不包含某些数据,并且列表将被打乱。

按一列对Excel数据进行排序 (Sort Excel Data by One Column)

In some lists, you might want to sort by one column. For example, in a list of sales orders, you could sort by Order Number.

在某些列表中,您可能希望按一列排序。 例如,在销售订单列表中,您可以按订单编号排序。

  • Select all the cells in the list. Tip: Use the keyboard shortcut Ctrl + A.

    选择列表中的所有单元格。 提示 :使用键盘快捷键Ctrl +A。

  • On the Ribbon, click the Data tab, then click Sort.

    在功能区上,单击“数据”选项卡,然后单击“排序”。
DataSortCommand
  • From the Sort by dropdown, select the column you want to sort.

    从“ 排序依据”下拉列表中,选择要排序的列。

    Note: If the dropdown is showing Column letters instead of headings, add a check mark to My data has headers.

    注意:如果下拉列表显示的是列字母而不是标题,请在“ 我的数据具有标题”中添加一个复选标记。

  • From the Sort On drop down, select Values.

    从“排序依据”下拉列表中,选择“值”。
  • From the Order drop down, select A to Z, or Z to A.

    从订单下拉列表中,选择A到Z,或Z到A。
  • Click OK

    点击确定

按两列或更多列对Excel数据进行排序 (Sort Excel Data by Two or More Columns)

Sometimes you need to sort by multiple columns. For example, in a list of sales orders, you could sort by Customer Name and then by Order Date.

有时您需要按多列排序。 例如,在销售订单列表中,您可以按“客户名称”然后按“订单日期”排序。

The customers would be sorted alphabetically, and if there are multiple orders for a customer, those orders would be sorted by date.

客户将按字母顺序排序,如果一个客户有多个订单,则这些订单将按日期排序。

  • Follow steps 1 to 5 in the Sort Excel Data by One Column instructions above, to sort by Customer Name.

    按照上面的“按一列对Excel数据进行排序”中的步骤1至5进行操作,以按客户名称进行排序。
  • Click Add Level

    单击添加级别
SortAddLevel
  • From the Then By drop down, select the second column that you want to sort – Order Date in this example.

    从“然后按”下拉列表中,选择要排序的第二列–在此示例中为“订购日期”。
SortTwoLevels
  • Add other levels, if necessary.

    如有必要,添加其他级别。
  • Click OK

    点击确定

翻译自: https://contexturesblog.com/archives/2009/04/12/safely-sorting-data-in-excel/

c# excel 数据排序

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值