How to Sort CSV File in Excel: 2 Quick Methods

Method 1 – Sort CSV File Automatically with Columns in Excel

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

Sort CSV File Automatically with Columns in Excel

  • Open a new Excel workbook.
  • Go to the Data tab and click on Get Data under the Get & Transform Data group.

  • Select From Text/CSV under the From File group in the drop-down section.

  • Select the CSV file from your device folder and press Import.

  • See the preview window.
  • Select the File Origin as 65001: Unicode (UTF- 8) and Delimiter as Comma.

  • Press Load and you will get the CSV file in Excel.

  • Select the cell range D3:D7 and right-click on it.
  • Choose the Format Cells option in the Context Menu.

  • Select Accounting in the Number section and change the Symbol according to your preference.
  • Press OK to get the Sales Amount as per the CSV file.

  • Sorting the dataset, go to the Data tab and select Sort.

Sort CSV File Automatically with Columns in Excel

  • Select the category Quantity in the Sort by section.
  • Select the order Smallest to Largest under the Order section in the Sort window.

Sort CSV File Automatically with Columns in Excel

  • Get the CSV file with columns in a sorted way like this.

How to Sort CSV File in Excel

  • Filter the CSV file, simply click on the Filter icon beside any of the headers.
  • Filter the category in the Text Filters section.

Sort CSV File Automatically with Columns in Excel

  • Because you deselected Kiwi and Orange, the final output is not showing the information related to these categories.


Method 2 – Organize CSV File in Excel Without Column

  • Go to the File tab of the workbook.

Organize CSV File in Excel Without Column

  • Click on Save As from the left panel.

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

  • Get the CSV file as text and without columns like this.

  • Ornament the dataset from the Font section in the Home tab.

  • The dataset will look like this.

  • Sort this CSV file.
  • Go to the Home tab and click on Sort & Filter.

Organize CSV File in Excel Without Column

  • Select any of the options in the drop-down menu for sorting the file.

Organize CSV File in Excel Without Column

  • Select Custom Sort to sort it more precisely.

Organize CSV File in Excel Without Column

  • Select the category Sales Amount in the Sort by section.
  • Choose the Order as Largest to Smallest.

Organize CSV File in Excel Without Column

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

  • Filter the dataset by clicking on the Filter icon in the Sort & Filter drop-down.

  • You will notice the filter icon beside each header title.
  • Filter the dataset according to your preference as we described in the first method.

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

Select the immediate next row of the header > go to the View tab > select Freeze Panes in the Window group.


Download Practice Workbook

Download this sample file to practice by yourself.


Related Articles


<< Go Back to Import CSV to Excel | Importing Data in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Sanjida Mehrun Guria
Sanjida Mehrun Guria

Hello! Welcome to my blog. I have completed my Bachelor in Architecture from Ashanullah University of Science & Technology, Dhaka. I am a passionate, goal-oriented person with an immense thirst for knowledge and an attitude to grow continuously. Besides Architectural work, I find it very enthusiastic to work in Excel blogging. Exceldemy is a platform where I have got the opportunity to flourish my skill in Microsoft Excel and therefore, here I will be posting blogs related to... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo