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

Sort numerical text in Excel table

王林
Release: 2024-01-16 17:45:13
forward
1216 people have browsed it

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!

Related labels:
source:docexcel.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template