Excel allows you to customize the sort order of your data by creating a custom sort order. This can be useful when you have data that does not sort correctly using the built-in sort options, or when you want to sort data in a specific order that is not alphabetical or numerical.
To create a custom sort order in Excel:
Select the data that you want to sort.
Go to the Data tab, in the Sort & Filter group, click on the Sort A-Z button.
In the Sort dialog box, select the column that you want to sort by.
Click the Options button.
Select the "Sort On" option and choose "Custom List"
In the Custom List section, select the list you want to use or type in your own list.
Click OK to apply the custom sort order.
Alternatively, you can also use the VBA code to sort the data by a custom list. Here is an example of VBA code that sorts a range called "MyRange" using a custom list:
Copy code
With MyRange
.Sort Key1:=.Cells(1), Order1:=xlAscending, _
Key2:=.Cells(2), Order2:=xlAscending, _
Key3:=.Cells(3), Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=Application.Transpose(Array("custom1","custom2","custom3")), MatchCase:=False, Orientation:=xlTopToBottom
End With
This code sorts the data based on the order of the custom list. The custom list should be an array of the same length as the number of columns you're sorting.
It's important to note that you can use multiple custom lists and multiple columns in the same sort.
EXCEL తెలుగు HYDERABAD TELANGANA
Comments
Post a Comment