ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   return cell reference from any column (https://www.excelbanter.com/excel-worksheet-functions/44406-return-cell-reference-any-column.html)

Pirjo

return cell reference from any column
 
Hello

I am searching for a function to return the cell reference for a lookup
value that can be found in any row and any column in the table.
Say the table has 10 columns and 250 rows and I am looking for a value that
I write in a specified cell. I would like Excel to write the cell reference
to know where in the table I find this value.

I have found a function =CELL("address";INDEX(A:A;MATCH(K1;A:A;0)))
but this can be used in only one column. Now I have several columns and
changing this area to multicolumn returns #n/a (or #ref) because I believe
Match does not understand but one column.

can you, please, help me?
Pirjo


bj

one way to do this is to use a user defined function

a very brute force one I have used is

Function advl(val)
advl = Cells.Find(What:=val, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False , SearchFormat:=False).Address
End Function

if the value can be outside the table, you will have to expand the function
to goto find again when the address isn't suitable.

"Pirjo" wrote:

Hello

I am searching for a function to return the cell reference for a lookup
value that can be found in any row and any column in the table.
Say the table has 10 columns and 250 rows and I am looking for a value that
I write in a specified cell. I would like Excel to write the cell reference
to know where in the table I find this value.

I have found a function =CELL("address";INDEX(A:A;MATCH(K1;A:A;0)))
but this can be used in only one column. Now I have several columns and
changing this area to multicolumn returns #n/a (or #ref) because I believe
Match does not understand but one column.

can you, please, help me?
Pirjo


Pirjo

Hi

Thanks a lot! this works like charm :)

"bj" wrote:

one way to do this is to use a user defined function

a very brute force one I have used is

Function advl(val)
advl = Cells.Find(What:=val, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False , SearchFormat:=False).Address
End Function

if the value can be outside the table, you will have to expand the function
to goto find again when the address isn't suitable.

"Pirjo" wrote:

Hello

I am searching for a function to return the cell reference for a lookup
value that can be found in any row and any column in the table.
Say the table has 10 columns and 250 rows and I am looking for a value that
I write in a specified cell. I would like Excel to write the cell reference
to know where in the table I find this value.

I have found a function =CELL("address";INDEX(A:A;MATCH(K1;A:A;0)))
but this can be used in only one column. Now I have several columns and
changing this area to multicolumn returns #n/a (or #ref) because I believe
Match does not understand but one column.

can you, please, help me?
Pirjo



All times are GMT +1. The time now is 11:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com