excel34
excel34

Reputation: 469

How can I find the index of a row for a value in excel É

is there a function in excel which can find the index of the row for a particular value É

ie if I write function(5.77) it will return 5 , because 5.77 appears in row 5 .

'1 Frequency '2 4.14 '3 4.19 '4 5.17 '5 5.77 '6 6.39

Upvotes: 2

Views: 14502

Answers (3)

OfficeTricks.Com
OfficeTricks.Com

Reputation: 108

Range.Find & Lookup are other good option to get the Row number of search string.

Upvotes: 0

Adam Ralph
Adam Ralph

Reputation: 29956

You can use the MATCH() worksheet function. In order to use this in VBA, you need to use the WorksheetFunction object, which exposes a subset of the Excel worksheet functions. E.g.

Dim rowIndex as Long
rowIndex = WorksheetFunction.Match(5.77, Range(A1:A6))

Upvotes: 3

Aviad P.
Aviad P.

Reputation: 32669

The function is called MATCH. It doesn't return the row number, but it returns the index of the cell inside the range, you can add the base row number to that to get the actual row number.

PS. This is an excel function used in cell formulas, not an excel-vba function...

Upvotes: 1

Related Questions