# How to display a character when a value in the same row is the highest value in its column?

I have the following example table:

``````A | B
a | 5
b | 3
c | 1
d | 9  <=== expected result
e | 0
f | 4
``````

So it should display `d` as in the other column `9` is the highest value.

• Best practice is to mark the answer as best answered, so that future readers can benefit as well. Jan 17 '14 at 6:09
• Read more tour that in our help center. Jan 19 '14 at 13:11

You can use the following formula to accomplish that.

## Formula

``````=QUERY(B2:C7, "SELECT B, C ORDER BY C DESC LIMIT 1")
``````

## Explained

The `QUERY` formula shows column B and C, sorts the range descendingly (`ORDER BY`) and limits the result to just one row (`LIMIT 1`).

## Example

I've created an example file for you: find max and show row

An alternative ("Excel style"):

``````=index(A:A,match(max(B:B),B:B,0))
``````

`max(B:B)` to find the maximum value in ColumnB (ie `9`)

`match(max(B:B),B:B,0)` to find the row number where there is an exact match for `9` (the first found)

`=index(A:A,match(max(B:B),B:B,0))` to apply that row number (relative to the start of B:B) to ColumnA (relative to the start of A:A) and return the value there - `d`.