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 Practice Workbook
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.
- 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.
- Afterward, select From Text/CSV under the From File group in the drop-down section.
- Following, select the CSV file from your device folder and press Import.
- Accordingly, you will see the preview window.
- Here, select the File Origin as 65001: Unicode (UTF- 8) and Delimiter as Comma.
- After this, press Load and you will get the CSV file in Excel.
- Next, select the cell range D3:D7 and right-click on it.
- Following, choose the Format Cells option in the Context Menu.
- 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.
- Now, for sorting the dataset, go to the Data tab and select Sort.
- 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.
- Finally, you will get the CSV file with columns in a sorted way like this.
- 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.
- That’s it, as you deselected Kiwi and Orange, the final output is not showing the information related to these categories.
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.
- Then, click on Save As from the left panel.
- Following, select CSV UTF-8 (Comma delimited) (*.csv) as the file type and press Save.
- Accordingly, you will get the CSV file as text and without columns like this.
- Next, ornament the dataset from the Font section in the Home tab.
- Therefore, the dataset will look like this.
- Now, let us sort this CSV file.
- To do this, go to the Home tab and click on Sort & Filter.
- Following, select any of the options in the drop-down menu for sorting the file.
- Otherwise, select Custom Sort to sort it more precisely.
- Then, select the category Sales Amount in the Sort by section.
- Along with it, choose the Order as Largest to Smallest.
- Lastly, press OK and you will successfully sort the CSV file like this.
- Additionally, you can filter the dataset by clicking on the Filter icon in the Sort & Filter drop-down.
- 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.
To freeze this, select the immediate next row of the header > go to the View tab > select Freeze Panes in the Window group.
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)