Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default sort question

Quick question. I just realized that during my sort it goes from item
1 to item 10 then item 2 because its looking at just the digits not
the number as a whole. So is there a way to make it look at the whole
number my code is

With Sheets("Sheet1").Range("A1:E230")
.sort key1:=Sheets("Sheet1").Range("A1"), Order1:=xlAscending
End With

very simple!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default sort question

Actually, your data isn't numeric--it's text.

If you format the cells as general and reenter the values (or convert them to
numbers some other way), you'll be able to sort ok.

One way to convert those text numbers to number numbers:
select an empty cell
edit|Copy
select A1:A230 (your range to fix)
edit|paste special|click Add



wrote:

Quick question. I just realized that during my sort it goes from item
1 to item 10 then item 2 because its looking at just the digits not
the number as a whole. So is there a way to make it look at the whole
number my code is

With Sheets("Sheet1").Range("A1:E230")
.sort key1:=Sheets("Sheet1").Range("A1"), Order1:=xlAscending
End With

very simple!


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default sort question

Ps.

Just to verify...

Try this in a couple of empty cells:

=count(A1:A230)
=counta(a1:a230)

The first counts numbers in that range.
The second counts all the non-empty cells (text or numbers).

Dave Peterson wrote:

Actually, your data isn't numeric--it's text.

If you format the cells as general and reenter the values (or convert them to
numbers some other way), you'll be able to sort ok.

One way to convert those text numbers to number numbers:
select an empty cell
edit|Copy
select A1:A230 (your range to fix)
edit|paste special|click Add

wrote:

Quick question. I just realized that during my sort it goes from item
1 to item 10 then item 2 because its looking at just the digits not
the number as a whole. So is there a way to make it look at the whole
number my code is

With Sheets("Sheet1").Range("A1:E230")
.sort key1:=Sheets("Sheet1").Range("A1"), Order1:=xlAscending
End With

very simple!


--

Dave Peterson


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default sort question

On Jul 5, 4:05 pm, Dave Peterson wrote:
Ps.

Just to verify...

Try this in a couple of empty cells:

=count(A1:A230)
=counta(a1:a230)

The first counts numbers in that range.
The second counts all the non-empty cells (text or numbers).





Dave Peterson wrote:

Actually, your data isn't numeric--it's text.


If you format the cells as general and reenter the values (or convert them to
numbers some other way), you'll be able to sort ok.


One way to convert those text numbers to number numbers:
select an empty cell
edit|Copy
select A1:A230 (your range to fix)
edit|paste special|click Add


wrote:


Quick question. I just realized that during my sort it goes from item
1 to item 10 then item 2 because its looking at just the digits not
the number as a whole. So is there a way to make it look at the whole
number my code is


With Sheets("Sheet1").Range("A1:E230")
.sort key1:=Sheets("Sheet1").Range("A1"), Order1:=xlAscending
End With


very simple!


--


Dave Peterson


--

Dave Peterson- Hide quoted text -

- Show quoted text -


I am using both text and numbers and I need both. I tried doing the
pastespecial add function in the macros but it gave me an error. Is
there any other way to do this?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default sort question

If you have a mixture of text and numbers:

1
11
11A
11B
12
13
2
2A
22B

You're going to have trouble. I think you have a couple of choices.

Put the numbers in one column and put the letters in the adjacent column and
sort the data using both those columns.

Or use Text for all the data and enter the data nicer:

00001
00011
00011A
00011B
00012
00013
00002
00002A
00022B


Maybe you don't need to convert the text numbers to number numbers at all.

wrote:

On Jul 5, 4:05 pm, Dave Peterson wrote:
Ps.

Just to verify...

Try this in a couple of empty cells:

=count(A1:A230)
=counta(a1:a230)

The first counts numbers in that range.
The second counts all the non-empty cells (text or numbers).





Dave Peterson wrote:

Actually, your data isn't numeric--it's text.


If you format the cells as general and reenter the values (or convert them to
numbers some other way), you'll be able to sort ok.


One way to convert those text numbers to number numbers:
select an empty cell
edit|Copy
select A1:A230 (your range to fix)
edit|paste special|click Add


wrote:


Quick question. I just realized that during my sort it goes from item
1 to item 10 then item 2 because its looking at just the digits not
the number as a whole. So is there a way to make it look at the whole
number my code is


With Sheets("Sheet1").Range("A1:E230")
.sort key1:=Sheets("Sheet1").Range("A1"), Order1:=xlAscending
End With


very simple!


--


Dave Peterson


--

Dave Peterson- Hide quoted text -

- Show quoted text -


I am using both text and numbers and I need both. I tried doing the
pastespecial add function in the macros but it gave me an error. Is
there any other way to do this?


--

Dave Peterson


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort question?? SAM SEBAIHI Excel Discussion (Misc queries) 0 November 29th 06 02:03 AM
Sort question JOM Excel Programming 1 November 8th 06 04:12 AM
sort question D Excel Worksheet Functions 0 August 2nd 06 10:08 PM
Sort Question Patrick Simonds Excel Programming 5 December 21st 05 07:09 AM
sort question Romi Excel Discussion (Misc queries) 1 June 16th 05 11:25 PM


All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"