Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / October 2005

Tip: Looking for answers? Try searching our database.

How do I format cells so that room numbers such as 1402, 1405a will sort correctly?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan E - 31 Oct 2005 22:45 GMT
I'm trying to fix an Excel spreadsheet for a health care facility so that it
can sort data by the first column, whci is the patient's room number.  Room
numbers can be pure numerical, or have a suffix at the end (a or b).  So I
have e.g. room numbers 1306, 2204, 1401b, 1613, 1402b.  At the moment, the
column sorts so that all the room numbers with a suffix follow all the
numbers without a suffix.  I've formatted the cells as General, Numbers, or
Text, and get the same sort result each time.  How can I fix this?  HELP!

All help gratefully received and acknowledged.

Signature

Dan E
webbie(removethis)@preferredcountry.com

Bucky - 31 Oct 2005 23:28 GMT
> I've formatted the cells as General, Numbers, or
> Text, and get the same sort result each time.

There is an Excel concept that is tricky to understand. If you enter a
number in a General cell, it gets stored internally as a number (e.g.
1401). If you enter a text in a General cell, it gets stored as a
string (e.g. "1401b"). Once the data is stored internally, it does not
change regardless of what you set the cell format to (General, Number,
Text, etc).

What you want to do here is convert everything to String internally.
The way that I know how to do that is as follows:

1. Make the columns General format. This will allow you to see which
values are stored internally as Number vs String. Number is right
aligned. String is left aligned.

2. In a new cell, say B1, enter the formula B1=TEXT(A1, 0). Fill down.
This converts any numbers to text internally. You would think this
would allow the sort to work correctly now, but for some reason it
doesn't. We need one more step.

3. Select column B. Copy. Move to a new column C. Paste special >
Values. If you did it right, all the values should be left aligned
because they are stored internally as text. And if you have Excel 2003,
you should see little warning symbols "number stored as text". Now you
can sort with this column.

Note that all the columns should be in General format. This is less
confusing.
Bucky - 31 Oct 2005 23:34 GMT
> Once the data is stored internally, it does not
> change regardless of what you set the cell format to (General, Number,
> Text, etc).

Forgot to mention this for the future:

If you enter a number AFTER the cell format has been set to Text, then
it will be stored as a string internally. So after you do this one time
conversion, set the column format to TEXT. Then all future entries will
be good.
Dan E - 31 Oct 2005 23:46 GMT
Many thanks, Bucky. For general information of the newgroup, a complete
explanation and solution comes up under the topic "Troubleshoot Sorting" in
Excel 2003 Help.  Basically, as you say, data entered in a cell that is NOT
formatted as Text BEFORE typing the data doesn't sort as text. You have to
re-type (or use a smart re-entry method such as you describe) AFTER
formatting the cells as Text - then sort works OK.  Again, many thanks for
your help.

Dan
>> I've formatted the cells as General, Numbers, or
>> Text, and get the same sort result each time.
[quoted text clipped - 26 lines]
> Note that all the columns should be in General format. This is less
> confusing.
Roger Govier - 31 Oct 2005 23:35 GMT
Hi Dan

One way
Create a helper column with the formula =--Left(A1,4)
Substitute your column letter for A1. Copy down the column.
Mark the whole block of data but sort by the new helper column.

Regards

Roger Govier

> I'm trying to fix an Excel spreadsheet for a health care facility so that it
> can sort data by the first column, whci is the patient's room number.  Room
[quoted text clipped - 5 lines]
>
> All help gratefully received and acknowledged.
Dan E - 31 Oct 2005 23:47 GMT
Thanks, Roger.

Dan
> Hi Dan
>
[quoted text clipped - 17 lines]
>>
>> All help gratefully received and acknowledged.
bbuzz - 31 Oct 2005 23:41 GMT
Be more specific on how you want to sort data. Is the data you want to
retrieve stored horizontally ? I think I can help with a little more
info on the way your data is stored.

bbuzz

Signature

bbuzz

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.