Hongmu Notes

numerical sorting

The number column is arranged according to size, and ten will not come before nine.
100% Browser local processing 0 Data upload

🔀 Sort settings

💡 Instructions for use

  • Column numbers are counted from left to right in the data, and the first column is one, which is consistent with the column order in the spreadsheet software.
  • Text comparison is arranged in character order, and Chinese is in encoding order, so it is more suitable for names and numbers; numerical comparison will be parsed into numbers first and then compared.
  • After setting the second sort key, rows with the same value in the first column will be sorted according to the rules of the second column, and the result will be more in line with daily habits.
  • When the header is fixed, the first row does not participate in sorting and the position remains unchanged; if the first row is data, please switch this option to Unfixed.
  • The sorting is a stable sorting, and rows with identical values maintain their original order without disturbing their relative positions.
  • The data is only processed in the browser and is not uploaded or saved; if you need to keep the file, please copy or download the results.

The number column is arranged according to size, and ten will not come before nine.

Why can't we sort by character?

Based on the character-by-character comparison, ten will be ranked before nine.

The larger the amount of data, the harder it is to detect this misordering with the naked eye.

parsing

Thousandth commas will be removed first, and then compared according to numerical size.

Currency symbols and unit text will be ignored, leaving only the numerical part.

Negative numbers and decimals

Negative numbers are compared according to their numerical value and not according to their sign.

A half-width period is required for the decimal point, and a full-width period is usually not recognized.

Applicable data

Pure numeric columns such as scores, amounts, inventory, quantities, and ages.

It is recommended to clean the columns containing mixed text first, and then sort them by numerical values.

Result check

Check whether two adjacent rows maintain the same size relationship.

If ten and nine are found to be reversed, it means text comparison is used.

For columns such as fractions, amounts, and quantities, numerical comparison must be selected, otherwise ten will be ranked before nine.

📖 Glossary

sort key
The column according to which the sorting is based can be a single column or a combination of multiple columns arranged according to priority.
Ascending and descending order
Ascending order is from small to large or forward in character order, while descending order is the opposite. The results of the two directions for the same set of data are completely reversed.
stable sorting
Rows with the same sort key value maintain their original order and will not be swapped due to sorting.
numerical comparison
First parse the cell content into numbers and then compare the sizes to avoid misordering when comparing by characters.
text comparison
Compare one by one in character encoding order. Chinese characters are usually arranged in encoding order, which is suitable for names and numbers.
multi-level sorting
Sort by the first column first, then sort by the second column if the values are the same, and so on to form a hierarchical order.
Header
The field names in the first row of the table should be fixed in the first row when sorting to avoid being treated as data for comparison.
Group sorting
First sort by a certain column within the group, and then decide the order of the groups. It is often used to organize lists by department or region.
Null value handling
The arrangement position of the cell when it is empty. When comparing numerical values, space-time values ​​are usually sorted at the end, making it easier to see valuable data first.
delimiter
Characters used to separate columns, tabs used for content copied by spreadsheet software, and commas used for comma-delimited files.

🔗 All keywords and tutorials

Keywords page of the tool12a

Return to tool home page

❓ FAQ

Why does ten come before nine?
That is the result of character-by-character comparison, just use numerical comparison instead.
Do I need to manually remove the thousandth comma?
No, the numerical comparison will remove the thousandth place first and then compare the sizes.