View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
chemdude77 chemdude77 is offline
external usenet poster
 
Posts: 9
Default Returning the index of an array value?

If I have a 2D variant array with the following values:

Array(1,1) = 3.1 Array(2,1) = 0
Array(1,2) = 2.2 Array(2,2) = 3.5
Array(1,3) = 0 Array(2,3) = 0
Array(1,4) = 0 Array(2,4) = 2.2

I want to print out a term depending on what column of the array contains a
non-zero value. So I want to print out "A" if there is a value in column 1,
"B" if a value in column 2, "C" if a value in column 3, "D" if a value in
column 4, etc.. So in the example above I would get A and B (since 1,1 and
1,2 have nonzero values) in separate cells on my worksheet and then B and D
(from 2,2 and 2,4) in the next column on the worksheet in separate cells. I
hope I explained this well enough :) Any way to do this?

I would also like the values to be printed out in order based on the
descending values in the array, but this is probably asking a lot? Please
help!
Matt