简体   繁体   中英

In Excel, how do I locate a row, a column and a cell by referring to their names?

Background

I am working on a data-driven test suite, which uses an Excel file as its data source.

Problem

The layout of this Excel sheet is:

TestName            FirstName    SecondName    Address
End_To_End_Test     Bruce        Wayne         Gothm
Age_Rule_Test       Alice        Chen          Wonderland

How do I locate Bruce by using FirstName as the column reference and End_To_End_Test as the row reference?

I have been looking for a function that does something like:

cell = Excel.ColumnIndex("FirstName").RowIndex("End_To_End_Test") //cell.value = "Bruce"

Many thanks

so if you are trying to return the matching Firstname with the criteria "End_to_End_test" in the column Testname, this is how you do it:

=INDEX($B$2:$B$3,MATCH($F$7,$A$2:$A$3,0))

指标公式

if you want to have a dynamic solution where you can change the references with dropdownlists, this is how you do it:

=INDEX($A$2:$D$3,MATCH($G$8,INDEX($A$2:$D$3,,MATCH($I$8,$A$1:$D$1,0)),0),MATCH($I$9,$A$1:$D$1,0))

动态版本

Assuming your table starts in A1, you can find the:

Row: =MATCH(A2,A:A,0) (say in G1)
Column: =MATCH(B1,1:1,0) (say in G2)
Cell: =ADDRESS(G2,G1)
Cell content: =INDEX(A1:D3, MATCH("End_To_End_Test",A:A,0), MATCH("FirstName",1:1,0))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM