Question: ?VBA Question. Please include comments so I can follow along and learn. There is no easy way in Excel to output the location (row and
?VBA Question. Please include comments so I can follow along and learn.

There is no easy way in Excel to output the location (row and column number) of the maximum value of an array. It is possible to do this for a single row or a single column but not an array. Create a user- defined VBA function that will take a range as the argument and the function will output the row number or column number, depending upon how you use the function. LOCATEMAX([range],1)" should output the row number of the maximum value of the array and "=LOCATEMAX(range,2)" should output the column number of the maximum value of the array. Example Output: -20 -20 4 4 6 LOCATEMAX(A1:C3,2) -20 4 There is no easy way in Excel to output the location (row and column number) of the maximum value of an array. It is possible to do this for a single row or a single column but not an array. Create a user- defined VBA function that will take a range as the argument and the function will output the row number or column number, depending upon how you use the function. LOCATEMAX([range],1)" should output the row number of the maximum value of the array and "=LOCATEMAX(range,2)" should output the column number of the maximum value of the array. Example Output: -20 -20 4 4 6 LOCATEMAX(A1:C3,2) -20 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
