Computer >> Computer tutorials >  >> Software >> Office

How to Sort CSV File in Excel (2 Quick Methods)

Working with a CSV file in Excel is very common when you have data with names and addresses, product information, listing objects and lots more. But when the dataset is large, then things get a little complicated. This is when we need to sort CSV files in excel. Therefore, in this article, we will learn how to sort a CSV file in excel with 2 quick methods.

Download this sample file to practice by yourself.

What Is CSV File?

Before starting the process of sorting, let us know CSV in a nutshell. The term CSV stands for Comma Separated Values. It allows you to store data in a text or tabular format. It is a plain text file that makes website development quite easier. CSV files are also used widely in the e-commerce business.  It is a very handy file type to import into an excel spreadsheet or any other platform for a large database.

You can easily recognize a CSV file by its name. Because the file name contains the extension .csv beside it.

2 Quick Methods to Sort CSV File in Excel

We can sort a CSV file in Excel in two formats. Either it can be with columns in a table format, or without columns in a text format. In the following section, we will discuss both of them through a step by step process. So without any delay, let’s hop into the procedure.

1. Sort CSV File Automatically with Columns in Excel

Let’s see the process of sorting a CSV file with columns automatically.

  • In the beginning, create a text file like this with the information of Product, Quantity and Sales Amount for 5 types of fruits.

How to Sort CSV File in Excel (2 Quick Methods)

  • Then, open a new Excel workbook.
  • In this blank workbook, go to the Data tab and click on Get Data under the Get & Transform Data group.

How to Sort CSV File in Excel (2 Quick Methods)

  • Afterward, select From Text/CSV under the From File group in the drop-down section.

How to Sort CSV File in Excel (2 Quick Methods)

  • Following, select the CSV file from your device folder and press Import.

How to Sort CSV File in Excel (2 Quick Methods)

  • Accordingly, you will see the preview window.
  • Here, select the File Origin as 65001: Unicode (UTF- 8) and Delimiter as Comma.

How to Sort CSV File in Excel (2 Quick Methods)

  • After this, press Load and you will get the CSV file in Excel.

How to Sort CSV File in Excel (2 Quick Methods)

  • Next, select the cell range D3:D7 and right-click on it.
  • Following, choose the Format Cells option in the Context Menu.

How to Sort CSV File in Excel (2 Quick Methods)

  • Then, select Accounting in the Number section and change the Symbol according to your preference.
  • Lastly, press OK to get the Sales Amount as per the CSV file.

How to Sort CSV File in Excel (2 Quick Methods)

  • Now, for sorting the dataset, go to the Data tab and select Sort.

How to Sort CSV File in Excel (2 Quick Methods)

  • Afterward, select the category Quantity in the Sort by section.
  • Along with it, select the order Smallest to Largest under the Order section in the Sort window.

How to Sort CSV File in Excel (2 Quick Methods)

  • Finally, you will get the CSV file with columns in a sorted way like this.

How to Sort CSV File in Excel (2 Quick Methods)

  • Additionally, if you need to filter the CSV file, simply click on the Filter icon beside any of the headers.
  • Then, filter the category in the Text Filters section.

How to Sort CSV File in Excel (2 Quick Methods)

  • That’s it, as you deselected Kiwi and Orange, the final output is not showing the information related to these categories.

How to Sort CSV File in Excel (2 Quick Methods)

Read More: How to Open CSV File in Excel with Columns Automatically (3 Methods)

Similar Readings

  • Excel VBA to Import CSV File without Opening (3 Suitable Examples)
  • How to Open Notepad or Text File in Excel with Columns (3 Easy Methods)
  • Excel VBA: Read Text File into String (4 Effective Cases)
  • How to Open Large CSV Files in Excel (2 Easy Methods)
  • How to Fix CSV File in Excel (5 Common Problems)

2. Organize CSV File in Excel Without Column

Another method of sorting a CSV file is to import and sort without columns. For illustration, we will take the same Excel file that we created in the first method. Let’s see the process below.

  • Firstly, go to the File tab of the workbook.

How to Sort CSV File in Excel (2 Quick Methods)

  • Then, click on Save As from the left panel.

How to Sort CSV File in Excel (2 Quick Methods)

  • Following, select CSV UTF-8 (Comma delimited) (*.csv) as the file type and press Save.

How to Sort CSV File in Excel (2 Quick Methods)

  • Accordingly, you will get the CSV file as text and without columns like this.

How to Sort CSV File in Excel (2 Quick Methods)

  • Next, ornament the dataset from the Font section in the Home tab.

How to Sort CSV File in Excel (2 Quick Methods)

  • Therefore, the dataset will look like this.

How to Sort CSV File in Excel (2 Quick Methods)

  • Now, let us sort this CSV file.
  • To do this, go to the Home tab and click on Sort & Filter.

How to Sort CSV File in Excel (2 Quick Methods)

  • Following, select any of the options in the drop-down menu for sorting the file.

How to Sort CSV File in Excel (2 Quick Methods)

  • Otherwise, select Custom Sort to sort it more precisely.

How to Sort CSV File in Excel (2 Quick Methods)

  • Then, select the category Sales Amount in the Sort by section.
  • Along with it, choose the Order as Largest to Smallest.

How to Sort CSV File in Excel (2 Quick Methods)

  • Lastly, press OK and you will successfully sort the CSV file like this.

How to Sort CSV File in Excel (2 Quick Methods)

  • Additionally, you can filter the dataset by clicking on the Filter icon in the Sort & Filter drop-down.

How to Sort CSV File in Excel (2 Quick Methods)

  • Following, you will notice the filter icon beside each header title.
  • Finally, you can filter the dataset according to your preference as we described in the first method.

How to Sort CSV File in Excel (2 Quick Methods)

Note: If you are using Excel Online or any version other than Excel 365 then you need to freeze the header row before sorting. Otherwise, the header row will act as other cells and get sorted along with cells.

To freeze this, select the immediate next row of the header > go to the View tab > select Freeze Panes in the Window group.

How to Sort CSV File in Excel (2 Quick Methods)

Read More: How to Open CSV File with Columns in Excel (3 Easy Ways)

Conclusion

Finally, we are concluding our article. I hope that it was a helpful one on how to sort CSV file in excel with 2 quick methods. Let us know if you have any other methods to sort CSV files. Follow ExcelDemy for more Excel related tutorials.

Related Articles

  • How to Convert CSV to XLSX without Opening (5 Easy Methods)
  • How to Read CSV File in Excel (4 Fastest Ways)
  • [Solved:] Excel Is Opening CSV Files in One Column (3 Solutions)
  • Excel VBA to Read CSV File into Array (4 Ideal Examples)
  • How to Import Text File to Excel Automatically (2 Suitable Ways)
  • Excel VBA: Read a Text File Line by Line (6 Related Examples)