Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Odd Lookup Formula

Hi. Can I write a formula that will scan all fo Sheet2, with a lookup
value in cell Sheet1!A1, and return the value in the cell that is 8
rows directly below the cell where the lookup value is found?

Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Odd Lookup Formula

=offset(sheet2!$C$1,Match(Sheet1!$A$1,Sheet2!$C:$C ,0)-1,0)

would give you the found cell

=offset(sheet2!$C$1,Match(Sheet1!$A$1,Sheet2!$C:$C ,0)+7,0)
would be 8 cells below (depending on how you count the 8)

You could also use Index
--
Regards,
Tom Ogilvy

"Steve" wrote:

Hi. Can I write a formula that will scan all fo Sheet2, with a lookup
value in cell Sheet1!A1, and return the value in the cell that is 8
rows directly below the cell where the lookup value is found?

Thanks!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Odd Lookup Formula

All of Sheet2? Or just a certain row in Sheet2? I don't believe you
can use a formula to search a entire worksheet for a value. If you
are searching a particular row, you can use the HLookup function to
get a value that is 8 rows down from teh found value.
Steve wrote:
Hi. Can I write a formula that will scan all fo Sheet2, with a lookup
value in cell Sheet1!A1, and return the value in the cell that is 8
rows directly below the cell where the lookup value is found?

Thanks!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Odd Lookup Formula

Right, I know I how to use the HLookup. But I need to search an
entire sheet (ar a large array), but NOT a single row or single
column!!

On Sep 19, 11:52 am, JW wrote:
All of Sheet2? Or just a certain row in Sheet2? I don't believe you
can use a formula to search a entire worksheet for a value. If you
are searching a particular row, you can use the HLookup function to
get a value that is 8 rows down from teh found value.



Steve wrote:
Hi. Can I write a formula that will scan all fo Sheet2, with a lookup
value in cell Sheet1!A1, and return the value in the cell that is 8
rows directly below the cell where the lookup value is found?


Thanks!- Hide quoted text -


- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Odd Lookup Formula

Thanks Tom. Question - this works great if what I am looking for is
in column C. But I have no idea what column it may be in! Is there a
way to scan multiple columns and rows? For instance, my array would
be A1:Z5000. My lookup value can be anywhere in that array. Thanks
so much!!

On Sep 19, 11:52 am, Tom Ogilvy
wrote:
=offset(sheet2!$C$1,Match(Sheet1!$A$1,Sheet2!$C:$C ,0)-1,0)

would give you the found cell

=offset(sheet2!$C$1,Match(Sheet1!$A$1,Sheet2!$C:$C ,0)+7,0)
would be 8 cells below (depending on how you count the 8)

You could also use Index
--
Regards,
Tom Ogilvy



"Steve" wrote:
Hi. Can I write a formula that will scan all fo Sheet2, with a lookup
value in cell Sheet1!A1, and return the value in the cell that is 8
rows directly below the cell where the lookup value is found?


Thanks!- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Odd Lookup Formula

Steve,

Could have sworn I read "particular column", but I guess not. Nothing
immediately comes to mind. It sounds like you want a formula solution, so to
increase your odds you should ask in Worksheet.Functions or Misc.

--
Regards,
Tom Ogilvy

"Steve" wrote:

Thanks Tom. Question - this works great if what I am looking for is
in column C. But I have no idea what column it may be in! Is there a
way to scan multiple columns and rows? For instance, my array would
be A1:Z5000. My lookup value can be anywhere in that array. Thanks
so much!!

On Sep 19, 11:52 am, Tom Ogilvy
wrote:
=offset(sheet2!$C$1,Match(Sheet1!$A$1,Sheet2!$C:$C ,0)-1,0)

would give you the found cell

=offset(sheet2!$C$1,Match(Sheet1!$A$1,Sheet2!$C:$C ,0)+7,0)
would be 8 cells below (depending on how you count the 8)

You could also use Index
--
Regards,
Tom Ogilvy



"Steve" wrote:
Hi. Can I write a formula that will scan all fo Sheet2, with a lookup
value in cell Sheet1!A1, and return the value in the cell that is 8
rows directly below the cell where the lookup value is found?


Thanks!- Hide quoted text -


- Show quoted text -




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Odd Lookup Formula

Thanks Tom. I thought a formula solution would be
easiest...apparently not! Anyway, it doesn't need to be a formula
solution, so can it be done with code?

On Sep 19, 12:48 pm, Tom Ogilvy
wrote:
Steve,

Could have sworn I read "particular column", but I guess not. Nothing
immediately comes to mind. It sounds like you want a formula solution, so to
increase your odds you should ask in Worksheet.Functions or Misc.

--
Regards,
Tom Ogilvy



"Steve" wrote:
Thanks Tom. Question - this works great if what I am looking for is
in column C. But I have no idea what column it may be in! Is there a
way to scan multiple columns and rows? For instance, my array would
be A1:Z5000. My lookup value can be anywhere in that array. Thanks
so much!!


On Sep 19, 11:52 am, Tom Ogilvy
wrote:
=offset(sheet2!$C$1,Match(Sheet1!$A$1,Sheet2!$C:$C ,0)-1,0)


would give you the found cell


=offset(sheet2!$C$1,Match(Sheet1!$A$1,Sheet2!$C:$C ,0)+7,0)
would be 8 cells below (depending on how you count the 8)


You could also use Index
--
Regards,
Tom Ogilvy


"Steve" wrote:
Hi. Can I write a formula that will scan all fo Sheet2, with a lookup
value in cell Sheet1!A1, and return the value in the cell that is 8
rows directly below the cell where the lookup value is found?


Thanks!- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Odd Lookup Formula

here's a convoluted way using vb to find your criteria and then creating a
formula in the cell. i put the formula in C1 in this example. i tried to break
the formula line so it wouldn't wrap, if there's a problem, just put it all on 1
line.

Sub test()
Dim rngfound As Range
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")

With ws2.Cells
Set rngfound = .Find(ws1.Range("A1"), LookIn:=xlValues, lookat:=xlWhole)
If Not rngfound Is Nothing Then
ws1.Range("c1").Formula = "=hlookup(A1" & ",Sheet2!" & _
Range(Cells(rngfound.Row, rngfound.Column).Address, _
Cells(rngfound.Row + 8, rngfound.Column)).Address & ",9,False)"
End If
End With
End Sub

--


Gary


"Steve" wrote in message
ps.com...
Thanks Tom. I thought a formula solution would be
easiest...apparently not! Anyway, it doesn't need to be a formula
solution, so can it be done with code?

On Sep 19, 12:48 pm, Tom Ogilvy
wrote:
Steve,

Could have sworn I read "particular column", but I guess not. Nothing
immediately comes to mind. It sounds like you want a formula solution, so to
increase your odds you should ask in Worksheet.Functions or Misc.

--
Regards,
Tom Ogilvy



"Steve" wrote:
Thanks Tom. Question - this works great if what I am looking for is
in column C. But I have no idea what column it may be in! Is there a
way to scan multiple columns and rows? For instance, my array would
be A1:Z5000. My lookup value can be anywhere in that array. Thanks
so much!!


On Sep 19, 11:52 am, Tom Ogilvy
wrote:
=offset(sheet2!$C$1,Match(Sheet1!$A$1,Sheet2!$C:$C ,0)-1,0)


would give you the found cell


=offset(sheet2!$C$1,Match(Sheet1!$A$1,Sheet2!$C:$C ,0)+7,0)
would be 8 cells below (depending on how you count the 8)


You could also use Index
--
Regards,
Tom Ogilvy


"Steve" wrote:
Hi. Can I write a formula that will scan all fo Sheet2, with a lookup
value in cell Sheet1!A1, and return the value in the cell that is 8
rows directly below the cell where the lookup value is found?


Thanks!- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -





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
Utilizing a RANDBETWEEN() formula within a LOOKUP formula Rich Werk. Excel Discussion (Misc queries) 4 November 4th 09 03:01 AM
Lookup Formula Kaye Excel Discussion (Misc queries) 2 August 4th 08 09:26 PM
Lookup formula Frances C[_2_] Excel Discussion (Misc queries) 2 September 29th 07 07:32 PM
Need a lookup formula Scorpvin Excel Discussion (Misc queries) 3 August 17th 06 02:24 PM
Lookup Formula - but have a formula if it can't find/match a value Stephen Excel Worksheet Functions 11 June 14th 05 05:32 AM


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

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

About Us

"It's about Microsoft Excel"