[Solved] How do I get the row number?

Discuss the spreadsheet application
Post Reply
Ilan
Posts: 61
Joined: Tue Apr 15, 2008 9:44 am
Location: Haifa, Israel

[Solved] How do I get the row number?

Post by Ilan »

Suppose I have a list of expenses and I want to get the text defining the maximum expense.
For the sake of argument, the text is in column B and the expense in column D.
To get the maximum I would use =MAX(D1:D100), but I want to know what row that is.
If I knew the row I could put in column G1 =B10, where B10 would be some sort of variable.

This should be a simple question to someone with more experience than myself.

Thanks,
Ilan
Last edited by Ilan on Mon May 19, 2008 4:01 pm, edited 1 time in total.
OOo 3.0.X on Ubuntu 8.x + Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How do I get the row number?

Post by Villeroy »

Get the text in B from the row where max(D) is found:
=INDEX($B$1:$B$100;MATCH(MAX($D$1:$D$100);$D$1:$D$100;0))

MATCH returns an integer number>0 indicating the matched position (or #NA in case of no match).
INDEX returns a value out of a range, specified by the row index and (optional) column index.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply