Sorting Problems

D

dave

Yes putting a zero(or zeroes does the trick) If you'd
like to automate that it is possible without VB...

First you need to know your max value in all sections of
your 4 piece code - below I assume it is 999. Formulas
are at bottom - long, but works).

If you have all four numbers in separate cells, its easier
(use method1). If you have the all four numbers already
in one cell, see monster formula in method2.

A b c d row method1(see below)
3 4 23 2 2
3 14 23 20 3
3 4 23 21 4
3 4 23 22 5
13 4 23 3 6

method2(see below)
[in cell d9] 3.4.23.2 [converts to] 003.004.023.002

method 1 formula
=IF(A2<100,IF(A2<10,"00"&A2,"0"&A2),A2)&"."&IF(B2<100,IF
(B2<10,"00"&B2,"0"&B2),B2)&"."&IF(C2<100,IF
(C2<10,"00"&C2,"0"&C2),C2)&"."&IF(D2<100,IF
(D2<10,"00"&D2,"0"&D2),D2)

method2 requires a range to be set up with the following
numbers

named range - temp
2 '00 [' to format as text]
3 '0
4 [blank]


and, ready for this...formula2 is...

=VLOOKUP(FIND(".",D9,1),temp,3,0)&MID($D$9,1,FIND
(".",D9,1)-1)&"."&VLOOKUP(FIND(".",D9,FIND(".",D9,1)+1)-
FIND(".",D9,1),temp,3,0)&MID($D$9,FIND(".",D9,1)+1,(FIND
(".",D9,FIND(".",D9,1)+1)-FIND(".",D9,1))-1)&"."&VLOOKUP
(FIND(".",D9,FIND(".",D9,FIND(".",D9,1)+1)+1)-FIND
(".",D9,FIND(".",D9,1)+1),temp,3,0)&MID($D$9,FIND
(".",D9,FIND(".",D9,1)+1)+1,(FIND(".",D9,FIND(".",D9,FIND
(".",D9,1)+1)+1)-FIND(".",D9,FIND(".",D9,1)+1))-1)
&"."&VLOOKUP((LEN(D9)-FIND(".",D9,FIND(".",D9,FIND
(".",D9,1)+1)+1)+1),temp,3,0)&MID(D9,FIND(".",D9,FIND
(".",D9,FIND(".",D9,1)+1)+1)+1,RIGHT(D9,LEN(D9)-FIND
(".",D9,FIND(".",D9,FIND(".",D9,1)+1)+1)))

Oh yeah, then sort them.

:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top