I currently have a 3 dimensional array full of different values. I would like to find the indices corresponding to the "nth" smallest values in the array. For example... If the 3 smallest values were 0.1, 0.2 and 0.3 I would like to see, in order, the indices for these values. Any help would be greatly appreciated.
Asked
Active
Viewed 150 times
-2
-
...and the code you've tried?? – Jeremy Jun 29 '17 at 14:53
-
and the format of the indices? – CallumDA Jun 29 '17 at 14:55
-
I don't have any code for this yet because I dont know where to even start. I would like to create a new array that has the indices. So if 0.1, 0.2 and 0.3 were located at A(1,3,6), A(2, 4, 7) and A(3, 4,5) I would like to get an array that looks like this: [[ 1, 3, 6 ][ 2, 4, 7 ][ 3, 4, 5 ]] – N. Whyter Jun 29 '17 at 15:00
-
Would it help if I posted the code so far? – N. Whyter Jun 29 '17 at 15:09
-
New question: https://stackoverflow.com/questions/44830532/find-the-indices-for-the-minimum-values-in-a-multi-dimensional-array-in-vba?noredirect=1#comment76643767_44830532 – Tim Williams Jun 29 '17 at 17:39
1 Answers
0
A possible way to approach this would be adding an original index dimension into your 3rd array, then sorting, by the current values to find out the smallest item and returning the original index. Take a look into this: VBA array sort function?

MNF
- 82
- 7