Namaste!
How to sort a list alphabetically if it is in a language other than English (e. g. Nepali/ Hindi)?
Thanks in advance.
Namaste!
How to sort a list alphabetically if it is in a language other than English (e. g. Nepali/ Hindi)?
Thanks in advance.
This might take some tinkering...
I found this macro online:
Public Function AlphaSortHelper(s As String)
Dim alpha As String, tmp As String, c As Long
alpha = "AaBbCcDd"
tmp = Chr(183)
For c = 1 To Len(s)
If CBool(InStr(1, alpha, Mid(s, c, 1))) Then
tmp = tmp & Format(InStr(1, alpha, Mid(s, c, 1)), "000")
Else
tmp = tmp & Format(AscW(Mid(s, c, 1)), "000")
End If
Next c
AlphaSortHelper= tmp
End Function
This is a UDF. You are supposed to put this formula into the cell to the right of the column that you want to sort and copy it down.
If you want to sort column A, put this in column B and copy down:
AlphaSortHelper(A1)
Then you can use this column to sort the list.
Important: You must update the macro with your alphabet in the order in which you want to sort it. The code has the start of the English alphabet to illustrate how to do it.
alpha = "AaBbCcDd"
Replace AaBbCcDd with your alphabet.
This might take some effort to get it working with your language but let me know how it goes!
Each script (not language) has its own sorting order. However sorting orders may also be different for languages using the same script, for example, where they have special characters. Windows determines the sorting order to use by the "locale" you have set for your computer. Got to Control Panel > Language and Region > Region > Formats => Format.
If you need to sort script/language of a locale other than the one set for your computer things become rather complicated. This link offers a preview of what you may have to study.
I tried this once and gave it up. It isn't too hard in VB or C#, but VBA just isn't intended for this sort of programming.
Namaste!
Thanks for your genuine replies. I think I've got a solution, though not good.
Now, I copy the list and paste on websites that convert "Preeti" font to unicode. Next job is to copy the result and paste in Excel. The unicodified list can be sorted alphabetically.
Edited:
One of the sites through google search is of Ashesh.
Thanks!