ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to sort column when cells contain both text & number (Sample X (https://www.excelbanter.com/excel-worksheet-functions/121965-how-sort-column-when-cells-contain-both-text-number-sample-x.html)

Hreinn

How to sort column when cells contain both text & number (Sample X
 
How to sort column when cells contain both text and number, that is
Sample 1
Sample 2
Sample 3
etc.

When I sort as usual I get the undesired order
Sample 1
Sample 10
Sample 100
Sample 101
etc.

Instead of
Sample 1
Sample 2
Sample 3
etc.

This is problem is probably related to that Excel takes the cell content
only as text.
Thanks in advance.
--
Hreinn

Bernie Deitrick

How to sort column when cells contain both text & number (Sample X
 
Hreinn,

Use a helper column with the formula

=VALUE(MID(A1,LEN("Sample "),LEN(A1)))

copied down to match your data, then sort on that column.

HTH,
Bernie
MS Excel MVP


"Hreinn" wrote in message
...
How to sort column when cells contain both text and number, that is
Sample 1
Sample 2
Sample 3
etc.

When I sort as usual I get the undesired order
Sample 1
Sample 10
Sample 100
Sample 101
etc.

Instead of
Sample 1
Sample 2
Sample 3
etc.

This is problem is probably related to that Excel takes the cell content
only as text.
Thanks in advance.
--
Hreinn




Bernie Deitrick

How to sort column when cells contain both text & number (Sample X
 
I should have added 1 to the first LEN:

=VALUE(MID(A1,LEN("Sample ")+1,LEN(A1)))

to account for the possible lack of a space between the prefix "Sample" and the number, in case you
really aren't using "sample "

=VALUE(MID(A1,LEN("OtherWord")+1,LEN(A1)))

HTH,
Bernie
MS Excel MVP


"Hreinn" wrote in message
...
How to sort column when cells contain both text and number, that is
Sample 1
Sample 2
Sample 3
etc.

When I sort as usual I get the undesired order
Sample 1
Sample 10
Sample 100
Sample 101
etc.

Instead of
Sample 1
Sample 2
Sample 3
etc.

This is problem is probably related to that Excel takes the cell content
only as text.
Thanks in advance.
--
Hreinn




Hreinn

How to sort column when cells contain both text & number (Samp
 
Hello Bernie !

Thanks for your answears. But I get the Error In Formula message from Excel
when I put in your formula.

I replace the word Sample in your formula with the word syni (=Sample in
Icelandic) and I change the A1 into B4 which is where the first cell is. But
both of these changes should not matter.

The text in the cells has the void between the word syni (=sample) and the
number, so in the cells it is written; syni 1, syni 2 etc. (but not syni1,
syni2).

Do you have any further suggestions ? :o)
--
Hreinn


"Bernie Deitrick" wrote:

I should have added 1 to the first LEN:

=VALUE(MID(A1,LEN("Sample ")+1,LEN(A1)))

to account for the possible lack of a space between the prefix "Sample" and the number, in case you
really aren't using "sample "

=VALUE(MID(A1,LEN("OtherWord")+1,LEN(A1)))

HTH,
Bernie
MS Excel MVP


"Hreinn" wrote in message
...
How to sort column when cells contain both text and number, that is
Sample 1
Sample 2
Sample 3
etc.

When I sort as usual I get the undesired order
Sample 1
Sample 10
Sample 100
Sample 101
etc.

Instead of
Sample 1
Sample 2
Sample 3
etc.

This is problem is probably related to that Excel takes the cell content
only as text.
Thanks in advance.
--
Hreinn





Bernie Deitrick

How to sort column when cells contain both text & number (Samp
 
Hreinn,

This should work:

=VALUE(MID(B4,LEN("Syni ")+1,LEN(B4)))

HTH,
Bernie
MS Excel MVP


"Hreinn" wrote in message
...
Hello Bernie !

Thanks for your answears. But I get the Error In Formula message from
Excel
when I put in your formula.

I replace the word Sample in your formula with the word syni (=Sample in
Icelandic) and I change the A1 into B4 which is where the first cell is.
But
both of these changes should not matter.

The text in the cells has the void between the word syni (=sample) and the
number, so in the cells it is written; syni 1, syni 2 etc. (but not syni1,
syni2).

Do you have any further suggestions ? :o)
--
Hreinn


"Bernie Deitrick" wrote:

I should have added 1 to the first LEN:

=VALUE(MID(A1,LEN("Sample ")+1,LEN(A1)))

to account for the possible lack of a space between the prefix "Sample"
and the number, in case you
really aren't using "sample "

=VALUE(MID(A1,LEN("OtherWord")+1,LEN(A1)))

HTH,
Bernie
MS Excel MVP


"Hreinn" wrote in message
...
How to sort column when cells contain both text and number, that is
Sample 1
Sample 2
Sample 3
etc.

When I sort as usual I get the undesired order
Sample 1
Sample 10
Sample 100
Sample 101
etc.

Instead of
Sample 1
Sample 2
Sample 3
etc.

This is problem is probably related to that Excel takes the cell
content
only as text.
Thanks in advance.
--
Hreinn







Hreinn

How to sort column when cells contain both text & number (Samp
 
Hi again Bernie !

Unfortunatelly I still get the same message: "The formula you typed contains
an error".
I understand the meaning of the function you suggests, but I am not enough
familiar with them to see what is missing or is extra to understand why Excel
donÂīt like this formula.

Hreinn
--
Hreinn


"Bernie Deitrick" wrote:

Hreinn,

This should work:

=VALUE(MID(B4,LEN("Syni ")+1,LEN(B4)))

HTH,
Bernie
MS Excel MVP


"Hreinn" wrote in message
...
Hello Bernie !

Thanks for your answears. But I get the Error In Formula message from
Excel
when I put in your formula.

I replace the word Sample in your formula with the word syni (=Sample in
Icelandic) and I change the A1 into B4 which is where the first cell is.
But
both of these changes should not matter.

The text in the cells has the void between the word syni (=sample) and the
number, so in the cells it is written; syni 1, syni 2 etc. (but not syni1,
syni2).

Do you have any further suggestions ? :o)
--
Hreinn


"Bernie Deitrick" wrote:

I should have added 1 to the first LEN:

=VALUE(MID(A1,LEN("Sample ")+1,LEN(A1)))

to account for the possible lack of a space between the prefix "Sample"
and the number, in case you
really aren't using "sample "

=VALUE(MID(A1,LEN("OtherWord")+1,LEN(A1)))

HTH,
Bernie
MS Excel MVP


"Hreinn" wrote in message
...
How to sort column when cells contain both text and number, that is
Sample 1
Sample 2
Sample 3
etc.

When I sort as usual I get the undesired order
Sample 1
Sample 10
Sample 100
Sample 101
etc.

Instead of
Sample 1
Sample 2
Sample 3
etc.

This is problem is probably related to that Excel takes the cell
content
only as text.
Thanks in advance.
--
Hreinn







Bernie Deitrick

How to sort column when cells contain both text & number (Samp
 
Hreinn,

Send me a copy of your table - clean out any private info that I might sell on the open market
-) - and I will have a look. My private address is deitbe at consumer dot org

HTH,
Bernie
MS Excel MVP


"Hreinn" wrote in message
...
Hi again Bernie !

Unfortunatelly I still get the same message: "The formula you typed contains
an error".
I understand the meaning of the function you suggests, but I am not enough
familiar with them to see what is missing or is extra to understand why Excel
donīt like this formula.

Hreinn
--
Hreinn


"Bernie Deitrick" wrote:

Hreinn,

This should work:

=VALUE(MID(B4,LEN("Syni ")+1,LEN(B4)))

HTH,
Bernie
MS Excel MVP


"Hreinn" wrote in message
...
Hello Bernie !

Thanks for your answears. But I get the Error In Formula message from
Excel
when I put in your formula.

I replace the word Sample in your formula with the word syni (=Sample in
Icelandic) and I change the A1 into B4 which is where the first cell is.
But
both of these changes should not matter.

The text in the cells has the void between the word syni (=sample) and the
number, so in the cells it is written; syni 1, syni 2 etc. (but not syni1,
syni2).

Do you have any further suggestions ? :o)
--
Hreinn


"Bernie Deitrick" wrote:

I should have added 1 to the first LEN:

=VALUE(MID(A1,LEN("Sample ")+1,LEN(A1)))

to account for the possible lack of a space between the prefix "Sample"
and the number, in case you
really aren't using "sample "

=VALUE(MID(A1,LEN("OtherWord")+1,LEN(A1)))

HTH,
Bernie
MS Excel MVP


"Hreinn" wrote in message
...
How to sort column when cells contain both text and number, that is
Sample 1
Sample 2
Sample 3
etc.

When I sort as usual I get the undesired order
Sample 1
Sample 10
Sample 100
Sample 101
etc.

Instead of
Sample 1
Sample 2
Sample 3
etc.

This is problem is probably related to that Excel takes the cell
content
only as text.
Thanks in advance.
--
Hreinn










All times are GMT +1. The time now is 08:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com