Hello,
I have used the bubble sort to a one dimensional array data, and it appeared to work fine. The sort function is listed below:
Function SortItem(arrSort)
Dim k, j, temp
For k = UBound(arrSort) - 1 To 0 Step -1
For j= 0 To k
If Lcase(arrSort(j))>LCase(arrSort(j+1)) Then
temp=arrSort(j+1)
arrSort(j+1)=arrSort(j)
arrSort(j)=temp
End If
Next
Next
SortItem = arrSort
End Function
I would like to know if I can use the bubble sort to sort data with multiple fields (or multi-dimensional arrays). Any help would be greatly appreciated!
The data I need to have sorted are listed below:
Field1 Field2 Field3
Ashley AAbraham QPO
Abraham ABalla ABC
Agarwal Abhishek KLP
Aghapou Ali 0KJ
Bhawsar Andrew POFS
Al-Rayess Annette MJKL
Aihie AAlRayess FDS
Amigleo Arsenio HYG
Ballard Anna GNV
Bhawsar Abhijit WJKG
Thanks!
CluM09
I have used the bubble sort to a one dimensional array data, and it appeared to work fine. The sort function is listed below:
Function SortItem(arrSort)
Dim k, j, temp
For k = UBound(arrSort) - 1 To 0 Step -1
For j= 0 To k
If Lcase(arrSort(j))>LCase(arrSort(j+1)) Then
temp=arrSort(j+1)
arrSort(j+1)=arrSort(j)
arrSort(j)=temp
End If
Next
Next
SortItem = arrSort
End Function
I would like to know if I can use the bubble sort to sort data with multiple fields (or multi-dimensional arrays). Any help would be greatly appreciated!
The data I need to have sorted are listed below:
Field1 Field2 Field3
Ashley AAbraham QPO
Abraham ABalla ABC
Agarwal Abhishek KLP
Aghapou Ali 0KJ
Bhawsar Andrew POFS
Al-Rayess Annette MJKL
Aihie AAlRayess FDS
Amigleo Arsenio HYG
Ballard Anna GNV
Bhawsar Abhijit WJKG
Thanks!
CluM09