When you process an excel table, sometimes you may want to sort the rows by each column value in the row. This article will tell you how to implement it.
1. How To Sort Excel Rows By Column Values In The Row.
- Below is this example using data cells.
A B C D E F G 1 Sale Item iPhone iPad Macbook Pro Macbook Air Mac Mini Apple Watch 2 Unit Price($) 1000 900 1200 1300 1200 800 3 Sale Count 100 98 300 600 96 1000
- What I want to do is to sort the first row of the above cell range in ascending order. Below are the steps.
- First, transpose the rows and columns of the above cell range to get the below cell range, you can read the article How To Transpose Rows And Columns In Excel Table to learn how to do it.
A B C 1 Sale Item Unit Price($) Sale Count 2 Apple Watch 800 1000 3 iPad 900 98 4 iPhone 1000 100 5 Mac Mini 1200 96 6 Macbook Air 1300 600 7 Macbook Pro 1200 300
- Convert the above cell range to an excel table, you can read the article Excel Convert Table To Range Example And Vice Versa to learn more.
- Now you can sort column A or other columns in the above table by clicking the down arrow beside the column title item such as Sale Item.
- Then click the item Sort A to Z in the popup menu list, this will sort the cells of the column in ascending order.
- Select the sorted table and transpose the rows and columns of the table to get another cell range, you can read the article How To Transpose Rows And Columns In Excel Table to learn how to do it.
- Then you can find the row in the result cell range has been sorted in ascending order like below.
A B C D E F G 1 Sale Item Apple Watch iPad iPhone Mac Mini Macbook Air Macbook Pro 2 Unit Price($) 800 900 1000 1200 1300 1200 3 Sale Count 1000 98 100 96 600 300