Wednesday, July 6, 2016

[Solved] alphanumeric sort

alphanumeric sort

I have a column of alphanumeric data (over 3000 records):
11-6140-203-14-1
11-6140-203-23&P
11-6605-200-12
43-0001-34
43-0139
5-301-4
5-4320-259-12
5-4330-217-12
55-1520-210-BD
55-1520-210-CL
5-5430-210-12
5-6115-332-14
 
I have used the Substitute command to replace the "-" with an alternate character.
(I tried "!" and "0") to no avail.  I need the data to sort out as follows:
43-0001-34
43-0139
5-301-4
5-4320-259-12
5-4330-217-12
5-5430-210-12
5-6115-332-14
55-1520-210-BD
55-1520-210-CL
11-6140-203-14-1
11-6140-203-23&P
11-6605-200-12
If this isn't possible in Excel, can it be done in Access?
 
Any help would be appriciated.

Anwsers to the Problem alphanumeric sort

Download Error Fixer (Free)

Try this, but on a copy, not the original, as the results will overwrite your original data.
Again, this assumes your data is as on your spreadsheet:  No header rows, and nothing else of value on the worksheet.  This latter is important as were are using the UsedRange property to get the data to sort; so anything else on the worksheet will also
get moved around.
 
==========================================
Option Explicit
Sub SortSpecial()
     Dim SortingWS As Worksheet
     Dim Aws As Worksheet
     Dim rg As Range, rg2 As Range
     Dim LastCol As Long, LastRow As Long
     Dim i As Long
    
Application.ScreenUpdating = False
Set rg = ActiveSheet.UsedRange
LastCol = rg.SpecialCells(xlCellTypeLastCell).Column
LastRow = rg.SpecialCells(xlCellTypeLastCell).Row
Set SortingWS = ThisWorkbook.Worksheets.Add(Type:=xlWorksheet)
 rg.Copy Destination:=SortingWS.Range("A1")
 Set rg2 = SortingWS.Range("B1", Cells(LastRow, "B"))
 rg2.TextToColumns Destination:=Cells(1, LastCol + 1), DataType:=xlDelimited, _
         TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
         Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
         :="-", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
         1)), TrailingMinusNumbers:=True
        
With SortingWS.Sort
     With .SortFields
         .Clear
       For i = LastCol + 1 To SortingWS.UsedRange.Columns.Count
         .Add Key:=Range(Cells(1, i), Cells(SortingWS.UsedRange.Rows.Count, i)) _
             , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
       Next i
     End With
        
    .SetRange SortingWS.UsedRange
     .Header = xlNo
     .MatchCase = False
     .Orientation = xlTopToBottom
     .SortMethod = xlPinYin
     .Apply
 End With
        
Range("A1", Cells(LastRow, LastCol)).Copy Destination:=rg
With rg.Worksheet.Cells
    .EntireColumn.AutoFit
    .EntireRow.AutoFit
End With
 
With Application
     .DisplayAlerts = False
         SortingWS.Delete
     .DisplayAlerts = True
     .ScreenUpdating = True
 End With
 End Sub
=======================================================

Use the System File Checker tool to repair corrupted or missing system files:

  1. Click Start.
  2. Type cmd, and then press CTRL+SHIFT+ENTER to open the elevated command prompt (I.e. Command prompt with administrative rights).
  3. The User Account Control window should appear, be sure that the action it exhibits is correct, and then press the Continue button.
  4. Type or copy paste the below command line into it without quotes:
  5. "Sfc /scannow"

Recommended Method to Fix the Problem: alphanumeric sort:

How to Fix alphanumeric sort with SmartPCFixer?

1. Download Error Fixer. Install it on your computer.

2. After the scan is done, you can see the errors and problems need to be fixed. Click Fix All.

3. The Fixing part is done, the speed of your computer will be much higher than before and the errors have been removed.


Related: error message fsui.exe/ wlidcli.dll is missing
,Solution to Error: Excel: Automatic number generation
,Troubleshoot:i wanna change language of all windows in Windows 7 Home Premium
,Troubleshooting:IF Function, if the vendor ID in column A matches any of the vendor ID's in column F, I want 1099 to appear in column D. Error
,Fast Solution to Problem: ReadyBoost is not working properly in my computer
,Troubleshoot:Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive. Error,External Hard Drive not listed in Windows 7 backup wizard Tech Support,Tech Support: I'm always being signed off so annoying,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.,Referencing data in Access using Excel [Anwsered],Need Best Way To Present Data [Anwsered],Same question but for windows 7 home edition,sometimes fullscreen won't activate [Solved],Solution to Error: We bought a new computer with windows 7 and it is constantly freezing. How do we fix this?,Solution to Error: Windows 8 update crash (2013-07-22),brclr.dll.mu_ Missing Error Fixer,How To Resolve Missing fin_myagtui.eng Problem,Corrupted f_0006ad File - How to Fix,nkebigvg.cpl Not Found Error Fixer,Corrupted olcontrols.ocx File - How to Fix
Read More: [Solved] Allowing mixed content in trusted sites only - IE 8,Troubleshooting:Applying a style and then undoing it reverts Heading 1 style back to original Word 2010 Heading 1 style,[Anwsered] Any fixes for Word locking up and crashing?,[Solved] App Crashes,Troubleshooting:An unsuspected error occurred during SYSTEM RESTORE 0x800703f1. Solution?,After Windows Update CD/DVD drive does not work,After installing windows 7 to laptop the labels print out of line how can I fix it,After my computer sleeps the wireless always disconnects and will no reconnect,After signing into Pogo.com, I get a message" This tab has been recovered"....what does this mean and how do I fix it.....,All desktop icons changed to windows live and does not open

No comments:

Post a Comment