Home  >  Article  >  Software Tutorial  >  Sort numerical text in Excel table

Sort numerical text in Excel table

王林
王林forward
2024-01-16 17:45:131138browse

Sort numerical text in Excel table

Number sorting problem in Excel text

Create an auxiliary column such as column B, and enter the formula in B1:

=IF(ISERROR(VALUE(LEFT(A1))),LEFT(A1,FIND("-",A1)-1),VALUE(LEFT(A1,FIND("-",A1)-1) ))

Copy the cell corresponding to column A.

Then sort by keyword in column B.

===============

It is also possible to split this column.

Before splitting, if there is data in column B, you can insert two columns on the left side of column B in advance and then split.

When splitting, select "-" as the dividing symbol.

After splitting, sort them with column A as the primary keyword, column B as the second keyword, and column C as the third keyword.

After completion, create an auxiliary column such as column D, and enter the formula in D1:

=IF(C1""",A1&"-"&B1&"-"&C1,A1&"-"&B1)

Copy the cell corresponding to column A.

Then copy column D, select column A, right-click/Paste Special, select "Value", and confirm. The data in column A is the result you want.

Delete the BCD column.

C sorting problem

I am using simple selection sorting

In fact, the idea is basically the same as that of bubbling. I will use the previous answer with slight changes

Bubble thinking: Compare two adjacent ones

Simple selection sorting idea:

Compare No.1 and No.2→if(1>2) transposition

Compare No.1 and No.3→if(1>3) transposition

Compare No.1 and No.4→if(1>4) transposition

#include

#define N 10

int main()

{

int i,j,k,temp;

int a[N];

for(i=1;iscanf("%d",&a[i]);

for(j=1;j{

k=j;

for (i=1;iif (a[j]>a[k i])

{

temp=a[j];

a[j]=a[k i];

a[k i]=temp;

}

}

for(i=1;iprintf("%d",a[i]);

printf("\n");

return 0;

}

The above is the detailed content of Sort numerical text in Excel table. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:docexcel.net. If there is any infringement, please contact admin@php.cn delete