How to column by numerical value?

Helios9

Board Regular
Joined
Oct 15, 2006
Messages
127
I have a single column, each cell beginning with 'RG-' and followed by a three or four digit number followed by '.jpg'. For example:

RG-9002.jpg
RG-2005.jpg
RG-201.jpg
RG-908.jpg
RG-550.jpg
RG-2009.jpg
RG-2548.jpg

I want to sort the column low to high, based on numerical value. The sort ascending function places the above cells into the order shown below.

RG-2005.jpg
RG-2009.jpg
RG-201.jpg
RG-2548.jpg
RG-550.jpg
RG-9002.jpg
RG-908.jpg

I need it to sort in numerical order, like this:

RG-201.jpg
RG-550.jpg
RG-908.jpg
RG-2005.jpg
RG-2009.jpg
RG-2548.jpg
RG-9002.jpg

Any help is much appreciated.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi Helios9:

Welcome to MrExcel Board!

Here is one way.

1) Let us say your FileNames begin in cell B2 and down. Cell B1 has the lable FileName

2) Use Column C as Intermediary column. C1 has lable Intermediary and in cell C2 write the formula ...
=TEXT(REPLACE(MID(B2,4,8),FIND(".",MID(B2,4,8)),4,""),"0000")
and copy it down as far as necessary

3) Now sort columns B:C by column C in Ascending Order. You may now optionally delete the Intermediary column

That should do it.
 
Upvote 0
Thank you Yogi. I appreciate the very fast response.

I did just discover another way also. I deleted the prefix (RG-) and suffix (.jpg) with the find-and-replace tool. The sort ascending tool then worked as desired and placed the numbers in true numerically ascending order. I then concatenated the suffix back into the column.

Best regards, Dean :LOL:
 
Upvote 0

Forum statistics

Threads
1,215,002
Messages
6,122,652
Members
449,092
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top