Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Split Window Diner
 
Posts: n/a
Default How do I sort a column consisting of fractions, decimals, and who.

I need to sort products by the horsepower. Horsepower can be a fraction,
decimal or whole number. For example, I need 1/100 to come before 1/10,
1/125 to come before 1/12, 1/10 to come before 1.0, 3/4 to come before
1...etc.
  #2   Report Post  
Mexage
 
Posts: n/a
Default

Why don't you use the Fraction format under Number format?

That way you only enter the decimal value and it will be represented by it's
fraction, but the sorter won't be confused.

Another option is to use this formula:

=IF(ISERR(SEARCH("/",E8)),VALUE(E8),LEFT(E8,SEARCH("/",E8)-1)/RIGHT(E8,SEARCH("/",E8)-1))

Where E8 is the value you need to convert from fraction or decimal to
decimal. With this formula you can create another column next to the
fractions, and you can sort by it's decimal values...

E F
8 '1/2 .5
9 '1/3 .33333
10 '1/30 .0333333

F8 would contain the formula I wrote, and you sort the entire table by
column F.

Hope that helps and if it does please vote for this answer.

G.Morales

"Split Window Diner" wrote:

I need to sort products by the horsepower. Horsepower can be a fraction,
decimal or whole number. For example, I need 1/100 to come before 1/10,
1/125 to come before 1/12, 1/10 to come before 1.0, 3/4 to come before
1...etc.

  #3   Report Post  
Splt Window Diner
 
Posts: n/a
Default



"Mexage" wrote:

Why don't you use the Fraction format under Number format?

That way you only enter the decimal value and it will be represented by it's
fraction, but the sorter won't be confused.

Another option is to use this formula:

=IF(ISERR(SEARCH("/",E8)),VALUE(E8),LEFT(E8,SEARCH("/",E8)-1)/RIGHT(E8,SEARCH("/",E8)-1))

Where E8 is the value you need to convert from fraction or decimal to
decimal. With this formula you can create another column next to the
fractions, and you can sort by it's decimal values...

E F
8 '1/2 .5
9 '1/3 .33333
10 '1/30 .0333333

F8 would contain the formula I wrote, and you sort the entire table by
column F.

Hope that helps and if it does please vote for this answer.

G.Morales

"Split Window Diner" wrote:

I need to sort products by the horsepower. Horsepower can be a fraction,
decimal or whole number. For example, I need 1/100 to come before 1/10,
1/125 to come before 1/12, 1/10 to come before 1.0, 3/4 to come before
1...etc.

This did not work on all of the values in the column. Some fractions did
not convert to decimal correctly and some did.
  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

What were the fractions that didn't convert?
And what did the formula return for those?


Splt Window Diner wrote:

"Mexage" wrote:

Why don't you use the Fraction format under Number format?

That way you only enter the decimal value and it will be represented by it's
fraction, but the sorter won't be confused.

Another option is to use this formula:

=IF(ISERR(SEARCH("/",E8)),VALUE(E8),LEFT(E8,SEARCH("/",E8)-1)/RIGHT(E8,SEARCH("/",E8)-1))

Where E8 is the value you need to convert from fraction or decimal to
decimal. With this formula you can create another column next to the
fractions, and you can sort by it's decimal values...

E F
8 '1/2 .5
9 '1/3 .33333
10 '1/30 .0333333

F8 would contain the formula I wrote, and you sort the entire table by
column F.

Hope that helps and if it does please vote for this answer.

G.Morales

"Split Window Diner" wrote:

I need to sort products by the horsepower. Horsepower can be a fraction,
decimal or whole number. For example, I need 1/100 to come before 1/10,
1/125 to come before 1/12, 1/10 to come before 1.0, 3/4 to come before
1...etc.

This did not work on all of the values in the column. Some fractions did
not convert to decimal correctly and some did.


--

Dave Peterson
  #5   Report Post  
Mexage
 
Posts: n/a
Default

Perhaps values like 1 1/2
in which case you would be better off using a macro.

Ok... here it goes without macros:

=IF(ISERR(SEARCH("/",A1)),VALUE(A1),IF(ISERR(SEARCH("
",TRIM(A1))),LEFT(A1,SEARCH("/",A1)-1)/MID(A1,SEARCH("/",A1)+1,10),VALUE(LEFT(A1,SEARCH("
",TRIM(A1))))+MID(A1,SEARCH(" ",TRIM(A1)),SEARCH("/",A1)-SEARCH("
",TRIM(A1)))/MID(A1,SEARCH("/",A1)+1,10)))

I know it's ugly, but it will take in numbers such as '1 1/3
Please only use one space between the fraction and the integer.

Hope that helps
if it does, please vote for this post

G.Morales
"Dave Peterson" wrote:

What were the fractions that didn't convert?
And what did the formula return for those?


Splt Window Diner wrote:

"Mexage" wrote:

Why don't you use the Fraction format under Number format?

That way you only enter the decimal value and it will be represented by it's
fraction, but the sorter won't be confused.

Another option is to use this formula:

=IF(ISERR(SEARCH("/",E8)),VALUE(E8),LEFT(E8,SEARCH("/",E8)-1)/RIGHT(E8,SEARCH("/",E8)-1))

Where E8 is the value you need to convert from fraction or decimal to
decimal. With this formula you can create another column next to the
fractions, and you can sort by it's decimal values...

E F
8 '1/2 .5
9 '1/3 .33333
10 '1/30 .0333333

F8 would contain the formula I wrote, and you sort the entire table by
column F.

Hope that helps and if it does please vote for this answer.

G.Morales

"Split Window Diner" wrote:

I need to sort products by the horsepower. Horsepower can be a fraction,
decimal or whole number. For example, I need 1/100 to come before 1/10,
1/125 to come before 1/12, 1/10 to come before 1.0, 3/4 to come before
1...etc.

This did not work on all of the values in the column. Some fractions did
not convert to decimal correctly and some did.


--

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
Return Count for LAST NonBlank Cell in each Row Sam via OfficeKB.com Excel Worksheet Functions 12 April 17th 05 10:36 PM
How do you sort a column of email addresses by domain name in Exc. Andy R Excel Discussion (Misc queries) 5 December 10th 04 09:26 PM
Why does a formula change when I sort a column pdhay Excel Worksheet Functions 1 December 9th 04 04:31 PM
How do I sort a column of formulas in Excel? Gordon Excel Discussion (Misc queries) 2 November 27th 04 01:55 AM
How do I sort a column of formulas in Excel? Gordon Excel Discussion (Misc queries) 0 November 26th 04 03:19 PM


All times are GMT +1. The time now is 11:20 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"