Sorry for the vague title…I couldn’t think of a way to sum up the question in a few words.
Let’s say that in Excel, I have two columns as shown:
Homer 3
Marge 4
Bart 2
Lisa 6
Maggie 5
I want another cell in the sheet to display the name of the person with the biggest number. Using the MAX function will only return the greatest value in the column, and the resulting cell would read “6”. Instead, I want to have a cell that says “Lisa”.
If I could just get a function to return the cell reference of the greatest value, instead of the value itself, I could use OFFSET to cause it to return the row heading. But I don’t know anything that does this. Or maybe that’s not how I want to do this. Is there a better way?
Are you commited to using Excel? I could try to come up with some very convoluted way to do this in Excel but MS Access is really the tool for this type of thing. Accomplishing this task in Access is pretty trivial.
Well, I just figured that out, as well. Weird thing is, it only faisl some of the time when the vector is out of order.
But I can use the MATCH function, and give it *match_type * 0, so that it will use any order. Using the returned position in the array and the OFFSET function, I can reference the right cell.
I came up with this, for column A having the text you want, and column B having the numbers, using INDIRECT and MATCH
=INDIRECT(ADDRESS(MATCH(MAX(B1:B7),B1:B7,0),1))