MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 4th, 2002, 09:32 PM   #1
Cobalt
New Member
 
Join Date: Apr 2002
Posts: 3
Default

I have a spreadsheet listing stamps. One of the columns is the Scott number, an ID number issued to the stamp. It could be 1 or 66a or 2354. My problem is that the stamps are recorded in groups, say 64-67a or 1-12 or 79-108 or 122 (group of one). How do I get these to sort so that the right order is achieved? I want 1-12, 13-17, 127, not 1-12, 127, 13-17. Can this be done?

Thanks!
Cobalt is offline   Reply With Quote
Old Apr 4th, 2002, 09:43 PM   #2
Anne Troy
MrExcel MVP
 
Anne Troy's Avatar
 
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
Default

If I were you, I'd separate my From and To values into two columns. Just make sure you've got a blank column to the right. Then select your whole column and hit Data-Text to Columns. Tell is to use the hyphen as the delimiter.

Then you should be able to easily sort by the first column. If it won't sort for you, it could be that your numbers are still being seen as text, and you may have to do the *Times One* fix to make them be seen as numbers.

The Times One Fix
Put a 1 in any cell that is not formatted as text. Copy the cell. Select your numbers, hit Edit-Paste special-Multiply.



_________________
TheWordExpert

[ This Message was edited by: Dreamboat on 2002-04-04 20:43 ]
Anne Troy is offline   Reply With Quote
Old Apr 4th, 2002, 10:05 PM   #3
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Hi Cobalt:
Continuing with the line of thinking of Dreambot's suggestion, you could insert a column, then use the following formula

=SUBSTITUTE(E2,"-",".")
Drag this formula down

so
1-12
13-17
127
will look like
1.12
13.17
127
Then EDIT|COPY and PASTE|SPECIAVALUES to convert these to truly as numeric values.
Then sort on this column.

Please post back if it works for you ... otherwise explain a little further and let us take it from there!
__________________
Regards!

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
www.energyefficientbuild.com
Yogi Anand is offline   Reply With Quote
Old Apr 4th, 2002, 10:10 PM   #4
Cobalt
New Member
 
Join Date: Apr 2002
Posts: 3
Default

Thanks! That seems to work for the pure numbers, but the 117a & c235 numbers still don't sort right. I would tell the owner that it just can't be done in a spreadsheet, but he swears one of his competition has a s/s that sorts his hyphenated Scott numbers.
Cobalt is offline   Reply With Quote
Old Apr 4th, 2002, 11:26 PM   #5
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-04-04 21:10, Cobalt wrote:
Thanks! That seems to work for the pure numbers, but the 117a & c235 numbers still don't sort right. I would tell the owner that it just can't be done in a spreadsheet, but he swears one of his competition has a s/s that sorts his hyphenated Scott numbers.
Hi Cobalt:
A generic solution in that case will be to convert your original entries to a dummy colum such as:
001-12
013-17
127
using a formula like =REPT("0",4-FIND("-",B19,1))&B19
to be the sort column.

I am sure others can suggest even still different ways of handling this!
__________________
Regards!

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
www.energyefficientbuild.com
Yogi Anand is offline   Reply With Quote
Old Apr 5th, 2002, 01:02 AM   #6
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-04 20:32, Cobalt wrote:
I have a spreadsheet listing stamps. One of the columns is the Scott number, an ID number issued to the stamp. It could be 1 or 66a or 2354. My problem is that the stamps are recorded in groups, say 64-67a or 1-12 or 79-108 or 122 (group of one). How do I get these to sort so that the right order is achieved? I want 1-12, 13-17, 127, not 1-12, 127, 13-17. Can this be done?

Thanks!
Consider the following sample in A1:A10.

{1;"66a";2354;"67a";"1-12";"64-67a";"79-108";122;"117a";"c235"}

In B1 enter:

=SUBSTITUTE(A1,"-","")

Give a double click on the fill handle of the cell B1 (in order to copy down the formula).

In C1 enter:

=SUBSTITUTE(B1,IF(ISNUMBER(RIGHT(B1)+0),SUBSTITUTE(B1,RIGHT(B1,SUMPRODUCT((LEN(B1)-LEN(SUBSTITUTE(B1,{0,1,2,3,4,5,6,7,8,9},""))))),""),SUBSTITUTE(B1,LEFT(B1,SUMPRODUCT((LEN(B1)-LEN(SUBSTITUTE(B1,{0,1,2,3,4,5,6,7,8,9},""))))),"")),"")

Give a double click on the fill handle of the cell C1.

Now sort the area in A to C on column C.

This is what I get as result:

{1;"1-12";"117a";122;"c235";2354;"64-67a";"66a";"67a";"79-108"}

After saving the formulas for future use, delete columns B and C.

Aladin



[ This Message was edited by: Aladin Akyurek on 2002-04-05 00:03 ]

[ This Message was edited by: Aladin Akyurek on 2002-04-05 00:04 ]
Aladin Akyurek is offline   Reply With Quote
Old Apr 8th, 2002, 09:14 PM   #7
Cobalt
New Member
 
Join Date: Apr 2002
Posts: 3
Default

Thanks for the great responses! Unfortunately, I haven't gotten anything that works. With Aladin's formulas, I start with 127, 1-12, 64a, c129, 15-17 and after, I get 1-12, 127, c129, 15-17, 64a. I'm about ready to tell the owner that it just can't be done.
Cobalt is offline   Reply With Quote
Old Apr 8th, 2002, 09:49 PM   #8
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-08 20:14, Cobalt wrote:
Thanks for the great responses! Unfortunately, I haven't gotten anything that works. With Aladin's formulas, I start with 127, 1-12, 64a, c129, 15-17 and after, I get 1-12, 127, c129, 15-17, 64a. I'm about ready to tell the owner that it just can't be done.
The result should have been:

{"1-12";
"15-17";
"64a";
127;
"c129"}

If so,

in D1 enter:

=IF(ISNUMBER(SEARCH("-",A1)),C1/(10^(LEN(A1)-SEARCH("-",A1))),C1+0)

and sort on column D.

Is this what is desired?




[ This Message was edited by: Aladin Akyurek on 2002-04-08 20:50 ]
Aladin Akyurek is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 08:10 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes