Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Use Formula to sort two strings

Dear experts

I design the following spreadsheet. Please advise how I can achieve the
result on column C (i.e. it sorts column A and B in ascending order, and puts
the smaller string in the front and the bigger one at the back)?

A B C
1 Atlanta Los Angeles Atlanta-Los Angeles
2 Orlando Chicago Chicago-Orlando
3 Mexico City Miami Mexico City-Miami


--
Best regards
Ray Ray
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Use Formula to sort two strings

Put this in C1 and drag down.

=IF(LEN(A1)<LEN(B1),A1&" "&B1,B1&" "&A1)

Mike

"Ray Ray" wrote:

Dear experts

I design the following spreadsheet. Please advise how I can achieve the
result on column C (i.e. it sorts column A and B in ascending order, and puts
the smaller string in the front and the bigger one at the back)?

A B C
1 Atlanta Los Angeles Atlanta-Los Angeles
2 Orlando Chicago Chicago-Orlando
3 Mexico City Miami Mexico City-Miami


--
Best regards
Ray Ray

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default Use Formula to sort two strings

From the look of the OP's example, perhaps he wants:
=IF(A1<B1,A1&"-"&B1,B1&"-"&A1)
--
David Biddulph

"Mike H" wrote in message
...
Put this in C1 and drag down.

=IF(LEN(A1)<LEN(B1),A1&" "&B1,B1&" "&A1)


"Ray Ray" wrote:

Dear experts

I design the following spreadsheet. Please advise how I can achieve the
result on column C (i.e. it sorts column A and B in ascending order, and
puts
the smaller string in the front and the bigger one at the back)?

A B C
1 Atlanta Los Angeles Atlanta-Los Angeles
2 Orlando Chicago Chicago-Orlando
3 Mexico City Miami Mexico City-Miami
--
Best regards
Ray Ray



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
Ascending Sort formula, change to neg #: descending sort.. nastech Excel Discussion (Misc queries) 6 July 2nd 07 11:00 PM
Is there a formula for searching for any one of a list of strings? bookgirl Excel Worksheet Functions 8 December 1st 06 06:55 PM
How to find number of pairs of strings from list of strings? greg_overholt Excel Worksheet Functions 5 January 27th 06 10:42 PM
Formula to strip figures from cells text strings mikeburg Excel Discussion (Misc queries) 5 August 15th 05 10:31 PM
How can I count strings within strings Paul W Excel Worksheet Functions 4 June 14th 05 12:39 PM


All times are GMT +1. The time now is 05:39 PM.

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

About Us

"It's about Microsoft Excel"