Hi,
I have a question about sorting some data and taking some values from my spreadsheet into variables in a program. Here is my problem:
Suppose that i have three rows (it could be more, but for this example, that's all i need). These rows are filled with numbers.
A B C D
------------------------------------------------
1 | 0 66 12 1
2 | 0 77 13 3
3 | 0 88 14 2
4 | 0 99 15 5
5 | 0 88 16 3
6 | 1 101 17 2
Ok, Now what i need to do is find the cell with the maximum value in column D. In this case that would be row 4. After finding the maximum value in column D, then I need to know what row that was so that I could use what row it was to get the corresponding information out of rows b and c. So, In this example, I need a function or some code to find the maximum value of column D, which is the value "5", then use that position to give me the value that it is in row 4, and save the information into variables. So before and after variables in my program will be:
Dim maxD as double
Dim correspondingB as double
Dim correspondingC as double
maxD = "the maximum value of column D"
correspondingB = "the value of the cell in column B associated with the row that maxD exists in"
correspondingC = "the value of the cell in column C associated with the row that maxD exists in"
So, After the operation is performed, the variables will hold the following values:
maxD = 5
correspondingB = 99
correspondingC = 15
This might be a simple question, but im not sure how to find the max value and then refer to a box in the same row but a different column. Or, if there was a function that returns the row of the cell that has the maximum value of a column, then that would help too. If anyone out there could help me it would be greatly appreciated, thanks
I have a question about sorting some data and taking some values from my spreadsheet into variables in a program. Here is my problem:
Suppose that i have three rows (it could be more, but for this example, that's all i need). These rows are filled with numbers.
A B C D
------------------------------------------------
1 | 0 66 12 1
2 | 0 77 13 3
3 | 0 88 14 2
4 | 0 99 15 5
5 | 0 88 16 3
6 | 1 101 17 2
Ok, Now what i need to do is find the cell with the maximum value in column D. In this case that would be row 4. After finding the maximum value in column D, then I need to know what row that was so that I could use what row it was to get the corresponding information out of rows b and c. So, In this example, I need a function or some code to find the maximum value of column D, which is the value "5", then use that position to give me the value that it is in row 4, and save the information into variables. So before and after variables in my program will be:
Dim maxD as double
Dim correspondingB as double
Dim correspondingC as double
maxD = "the maximum value of column D"
correspondingB = "the value of the cell in column B associated with the row that maxD exists in"
correspondingC = "the value of the cell in column C associated with the row that maxD exists in"
So, After the operation is performed, the variables will hold the following values:
maxD = 5
correspondingB = 99
correspondingC = 15
This might be a simple question, but im not sure how to find the max value and then refer to a box in the same row but a different column. Or, if there was a function that returns the row of the cell that has the maximum value of a column, then that would help too. If anyone out there could help me it would be greatly appreciated, thanks