#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Data Search

Hi all,

I have a spreadsheet with data in the range of A9:M30. The data looks like
this:
588 - Number in a cell directly above a name
Hill - Name in a cell directly below a number
Each row has numbers in it and the row immediately below that one has a name
in it. I am looking for a way to search this range so for instance when
"Hill" is found, I want to return the value in the cell directly above it.
All names and the corresponding values above this will always be unique---no
duplicate names or numbers. Any suggestions would be greatly appreciated.
Thanks.

Ron
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 964
Default Data Search

Here's one option:

=OFFSET(INDIRECT("A"&MATCH("Hill",A1:A100,0)),-1,0)

Replace "A" with the column letter that your data is in. You can also
replace "Hill" with a cell reference containing the value that you wish to
look up.

HTH,
Elkar


"Airfive" wrote:

Hi all,

I have a spreadsheet with data in the range of A9:M30. The data looks like
this:
588 - Number in a cell directly above a name
Hill - Name in a cell directly below a number
Each row has numbers in it and the row immediately below that one has a name
in it. I am looking for a way to search this range so for instance when
"Hill" is found, I want to return the value in the cell directly above it.
All names and the corresponding values above this will always be unique---no
duplicate names or numbers. Any suggestions would be greatly appreciated.
Thanks.

Ron

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,069
Default Data Search

Here's one way.

In a VBA module in the same workbook, add the following function:

Public Function FindAddr(MatchCell As Range, SearchArray As Range) As String
Dim c As Range
On Error GoTo FAerr
For Each c In SearchArray
If c.Value = MatchCell.Value Then
FindAddr$ = c.Address
Exit Function
End If
Next c
FAerr:
FindAddr$ = Null
End Function

On your worksheet, in (for example) cell A1 enter Hill or whatever name you
want to search for. In B1, enter this formula:

=OFFSET(INDIRECT(FindAddr($A$1,$A$9:$M$30)),-1,0)

Hope this helps,

Hutch


"Airfive" wrote:

Hi all,

I have a spreadsheet with data in the range of A9:M30. The data looks like
this:
588 - Number in a cell directly above a name
Hill - Name in a cell directly below a number
Each row has numbers in it and the row immediately below that one has a name
in it. I am looking for a way to search this range so for instance when
"Hill" is found, I want to return the value in the cell directly above it.
All names and the corresponding values above this will always be unique---no
duplicate names or numbers. Any suggestions would be greatly appreciated.
Thanks.

Ron

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Data Search

Sorry for the delay getting back to say thank you for your help. I think I
am now on the right track...........Thanks for everyone's help.

Ron

"Tom Hutchins" wrote:

Here's one way.

In a VBA module in the same workbook, add the following function:

Public Function FindAddr(MatchCell As Range, SearchArray As Range) As String
Dim c As Range
On Error GoTo FAerr
For Each c In SearchArray
If c.Value = MatchCell.Value Then
FindAddr$ = c.Address
Exit Function
End If
Next c
FAerr:
FindAddr$ = Null
End Function

On your worksheet, in (for example) cell A1 enter Hill or whatever name you
want to search for. In B1, enter this formula:

=OFFSET(INDIRECT(FindAddr($A$1,$A$9:$M$30)),-1,0)

Hope this helps,

Hutch


"Airfive" wrote:

Hi all,

I have a spreadsheet with data in the range of A9:M30. The data looks like
this:
588 - Number in a cell directly above a name
Hill - Name in a cell directly below a number
Each row has numbers in it and the row immediately below that one has a name
in it. I am looking for a way to search this range so for instance when
"Hill" is found, I want to return the value in the cell directly above it.
All names and the corresponding values above this will always be unique---no
duplicate names or numbers. Any suggestions would be greatly appreciated.
Thanks.

Ron

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Search Airfive Excel Worksheet Functions 2 November 20th 06 06:43 PM
Search through Data adz New Users to Excel 1 October 5th 06 07:39 AM
Duplicate Data Search Thomas O Excel Discussion (Misc queries) 3 May 1st 06 12:45 AM
Search for data using 'contains' JaB Excel Discussion (Misc queries) 1 November 10th 05 12:47 PM
Search data formulas - HELP!! Richard Excel Worksheet Functions 2 July 4th 05 07:33 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"