IRONSOFTWAREHOME
Sort Excel Ranges in C#
using IronXL;

WorkBook workBook = WorkBook.Load("sample.xlsx");
WorkSheet workSheet = workBook.DefaultWorkSheet;

// Select a range
var range = workSheet["A1:D20"];

// Select a column(B)
var column = workSheet.GetColumn(1);

// Sort the range in ascending order (A to Z)
range.SortAscending();

// Sort the range by column(C) in ascending order
range.SortByColumn("C", SortOrder.Ascending);

// Sort the column(B) in descending order (Z to A)
column.SortDescending();

workBook.SaveAs("sortExcelRange.xlsx");
Imports IronXL

Dim workBook As WorkBook = WorkBook.Load("sample.xlsx")
Dim workSheet As WorkSheet = workBook.DefaultWorkSheet

' Select a range
Dim range = workSheet("A1:D20")

' Select a column(B)
Dim column = workSheet.GetColumn(1)

' Sort the range in ascending order (A to Z)
range.SortAscending()

' Sort the range by column(C) in ascending order
range.SortByColumn("C", SortOrder.Ascending)

' Sort the column(B) in descending order (Z to A)
column.SortDescending()

workBook.SaveAs("sortExcelRange.xlsx")
NuGet Download
PM > Install-Package IronXL.Excel
Sort Excel Ranges in C#

Sort Excel Ranges in C#

データをアルファベット順または値の順に並べることで、Microsoft Excelでのデータの人間による分析が可能になります。 IronXLは、Excel Columns, Rows, Ranges をC#およびVB.NETでソートするのを非常に簡単にします。

選択した範囲またはカラムに対して SortAscending または SortDescending メソッドを使用して適切な順序で並べ替えを適用します。 ただし、SortByColumn メソッドには2つのパラメータが必要です: 最初の入力はソートすることを意図したカラムで、2番目の入力はソート順です。

C# で Excel の名前付き範囲の使い方を学ぶ

準備はできましたか?

Nuget Downloads 2,280,941バージョン:2026.10リリースされたばかり

Key in blue circle

無料の30日間トライアルキーをすぐに入手してください。

Your trial license will be sent to your email address

制限なし。100% ロック解除済み。クレジットカード不要。

bullet_checkedクレジットカードやアカウントの作成は不要です。制限なし。100% ロック解除済み。クレジットカード不要。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronXL
無料のライブデモを予約する
Booking Badge

世界中の数百万人のエンジニアから信頼されています。

ライセンスはより安く
義務のない相談を受ける
あなたの詳細は常に守秘されます。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
世界中の数百万人のエンジニアから信頼されています。
あなたの無料30日間の試用キーをすぐに入手。
クレジットカードやアカウントの作成は不要です。
PDF用C# NuGetライブラリ
NuGetでインストール

バージョン: 2026.10

PM > Install-Package IronXL.Excel
nuget.org/packages/IronXL.Excel/
  1. ソリューションエクスプローラーで参照を右クリックし、NuGetパッケージを管理を選択
  2. 参照選択し、"IronXL"を検索
  3. パッケージを選択してインストール
C# PDF DLL
DLLをダウンロード

バージョン: 2026.10

  1. IronXLを~/Libsなどの場所にダウンロードし、ソリューションディレクトリに解凍します
  2. Visual Studioのソリューションエクスプローラ内で参照を右クリックし、を選択「IronXL.dll」参照選択

ライセンス$999から