Home

SPECIAL NUMBER SORTING

%3CLINGO-SUB%20id%3D%22lingo-sub-823306%22%20slang%3D%22en-US%22%3ESPECIAL%20NUMBER%20SORTING%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-823306%22%20slang%3D%22en-US%22%3EI%20am%20trying%20to%20sort%20a%20spreadsheet%20with%20special%20numbers.%20it%20puts%20129.01.00A%20ahead%20of%2013.01.00%2C%2071.01.00%20etc.%20I%20want%20it%20to%20sort%20by%20the%20number%20ahead%20of%20the%20first%20decimal%2C%20then%20by%20the%20second%2C%20etc.%20e.g.%2013.01.00%20then%2071.01.00%20then%20129.01.00A%20I%20have%20tried%20formatting%20by%20number%2C%20by%20general%2C%20by%20accounting.%20Any%20help%20appreciated.%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-823306%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESorting%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-823646%22%20slang%3D%22en-US%22%3ERe%3A%20SPECIAL%20NUMBER%20SORTING%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-823646%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F398626%22%20target%3D%22_blank%22%3E%40JRoy-55%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOne%20variant%20is%20with%20VBA%20function.%20If%20with%20formulas%2C%20you%20may%20add%20helper%20columns%20for%20each%20level%20like%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20292px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F128616iA4D9294B37E56010%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFormulas%20could%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3ELeve%20l%3A%0A%3D--LEFT(A2%2CSEARCH(%22.%22%2CA2)-1)%0A%0ALevel%202%3A%0A%3D--MID(A2%2CSEARCH(%22.%22%2CA2)%2B1%2CSEARCH(%22.%22%2CA2%2CSEARCH(%22.%22%2CA2)%2B1)-SEARCH(%22.%22%2CA2)-1)%0A%0ALevel%203%3A%0A%3DRIGHT(A2%2CLEN(A2)-FIND(%22%40%22%2CSUBSTITUTE(A2%2C%22.%22%2C%22%40%22%2CLEN(A2)-LEN(SUBSTITUTE(A2%2C%22.%22%2C%22%22)))%2C1))%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EAfter%20that%20select%20all%204%20columns%20and%20Data-%26gt%3BSort%2C%20add%203%20levels%20of%20sorting.%20Helper%20columns%20could%20be%20hided%20after%20that.%3C%2FP%3E%3C%2FLINGO-BODY%3E
JRoy-55
Occasional Visitor
I am trying to sort a spreadsheet with special numbers. it puts 129.01.00A ahead of 13.01.00, 71.01.00 etc. I want it to sort by the number ahead of the first decimal, then by the second, etc. e.g. 13.01.00 then 71.01.00 then 129.01.00A I have tried formatting by number, by general, by accounting. Any help appreciated.
1 Reply

@JRoy-55 

One variant is with VBA function. If with formulas, you may add helper columns for each level like

image.png

Formulas could be

Leve l:
=--LEFT(A2,SEARCH(".",A2)-1)

Level 2:
=--MID(A2,SEARCH(".",A2)+1,SEARCH(".",A2,SEARCH(".",A2)+1)-SEARCH(".",A2)-1)

Level 3:
=RIGHT(A2,LEN(A2)-FIND("@",SUBSTITUTE(A2,".","@",LEN(A2)-LEN(SUBSTITUTE(A2,".",""))),1))

After that select all 4 columns and Data->Sort, add 3 levels of sorting. Helper columns could be hided after that.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies