logo
search
SharePoint Document Issues

How to Sort SharePoint Files and Folders in Numerical Order

Olivia MillerOlivia Miller Sep 28, 2026 868 views

Question details

The user needs to organize SharePoint files and folders in ascending numerical order rather than the default alphabetical order.

How to Sort SharePoint Files and Folders in Numerical Order
Product
Microsoft SharePoint
Device & OS
not provided
Scenario
Sorting documents or folders in a SharePoint library where names or metadata contain numbers.
Observed behavior
SharePoint treats numbers in text fields alphabetically, producing an incorrect sequence such as 1, 10, 2, 3 instead of 1, 2, 3, 10.
Before you start

Ensure you have the necessary site permissions to create columns and modify list or library views in your SharePoint environment.

Solution 1Recommended

Create a Calculated Column for Padded Numbers

Use a calculated formula to add leading zeros to your numbers, forcing SharePoint to sort them correctly in numerical order.

Because SharePoint reads text fields alphabetically, it compares the first digit of a number before the second, which is why 10 appears before 2. By transforming the numbers into a consistent length (e.g., 001, 002, 010), the alphabetical sorting logic will produce the correct numerical sequence.

1
Add a new column

Navigate to your SharePoint document library, click on 'Add column', and select 'More' to open the classic column settings page.

2
Set column type to Calculated

Enter a name for the new column, such as 'SortOrder', and choose 'Calculated (calculation based on other columns)' as the column type.

3
Input the text padding formula

In the formula box, type =TEXT([YourNumberColumn],"000"). Replace 'YourNumberColumn' with the exact internal name of the column containing your original numbers.

4
Configure return type

Under 'The data type returned from this formula is', select 'Single line of text', then click 'OK' to save the column.

5
Sort your library view

Edit your current library view to sort items by the newly created 'SortOrder' column in ascending order. You can choose to hide this column from the view layout so it does not clutter the interface.

Create a Calculated Column for Padded Numbers
Check Your Spacing: If the original column name contains spaces, you must include those spaces inside the brackets in the formula, for example: =TEXT([Order Number],"000").
Free Microsoft Office alternative

Manage and Edit Your Documents Seamlessly with WPS Office

While SharePoint handles cloud file storage and metadata, editing the actual Word, Excel, and PowerPoint files requires a reliable office suite. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Office for editing downloaded SharePoint documents locally.

Fully compatible with Microsoft Word, Excel, and PowerPoint file formats (.docx, .xlsx, .pptx).Lightweight installation that runs smoothly across Windows, Mac, and Linux.Familiar tabbed interface making document editing and management highly intuitive.Perfect for opening, formatting, and editing documents downloaded directly from SharePoint libraries.
microsoft office alternative - wps office

Frequently Asked Questions

Why does SharePoint sort 10 before 2?

SharePoint sorts text-based metadata columns alphabetically rather than numerically. In alphabetical sorting, the character '1' in '10' is evaluated before the character '2', resulting in an incorrect sequence of 1, 10, 2, 3 instead of 1, 2, 3, 10.

Can I hide the calculated SortOrder column from my main view?

Yes. Once you have applied the sorting settings to your library view based on the calculated column, you can edit the view and uncheck the 'SortOrder' column. It will continue to sort the files correctly in the background without being visible to users.

What should I do if SharePoint says my column does not exist in the formula?

Verify that you have typed the exact internal name of the column inside the brackets. If the original column name contains spaces, they must be included exactly as they appear, such as [Order Number]. Also, ensure you are creating a 'Calculated' column, rather than attempting to apply a validation formula to a standard text or number column.