Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Looking up values

The following two function work for looking up a value but if I make a
change to the Row/Column that contains the lookup value my lookup value does
not change. I have my sheet on automatic calculate. Should these function
types be ranges?


Function VLook(lookupValue As Range, LookupRange As Range, Column As
Integer) As Double
Dim cell As Range
For Each cell In LookupRange
If cell = lookupValue Then
VLook = cell.Offset(0, Column - 1)
End If
Next cell
End Function

Function HLook(lookupValue As Range, LookupRange As Range, Row As Integer)
As Double
Dim cell As Range
For Each cell In LookupRange
If cell = lookupValue Then
HLook = cell.Offset(Row - 1, 0)
Exit Function
End If
Next cell
End Function


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Looking up values

I find vlookup and hlookup to finicky.


"Don Guillett" wrote in message
...
Maybe you need to add application.volatile but

Why are you re-inventing the wheel?

"Nathan Carroll" wrote in message
...
The following two function work for looking up a value but if I make a
change to the Row/Column that contains the lookup value my lookup value

does
not change. I have my sheet on automatic calculate. Should these

function
types be ranges?


Function VLook(lookupValue As Range, LookupRange As Range, Column As
Integer) As Double
Dim cell As Range
For Each cell In LookupRange
If cell = lookupValue Then
VLook = cell.Offset(0, Column - 1)
End If
Next cell
End Function

Function HLook(lookupValue As Range, LookupRange As Range, Row As

Integer)
As Double
Dim cell As Range
For Each cell In LookupRange
If cell = lookupValue Then
HLook = cell.Offset(Row - 1, 0)
Exit Function
End If
Next cell
End Function






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Looking up values

Thanks that worked.


"Don Guillett" wrote in message
...
Maybe you need to add application.volatile but

Why are you re-inventing the wheel?

"Nathan Carroll" wrote in message
...
The following two function work for looking up a value but if I make a
change to the Row/Column that contains the lookup value my lookup value

does
not change. I have my sheet on automatic calculate. Should these

function
types be ranges?


Function VLook(lookupValue As Range, LookupRange As Range, Column As
Integer) As Double
Dim cell As Range
For Each cell In LookupRange
If cell = lookupValue Then
VLook = cell.Offset(0, Column - 1)
End If
Next cell
End Function

Function HLook(lookupValue As Range, LookupRange As Range, Row As

Integer)
As Double
Dim cell As Range
For Each cell In LookupRange
If cell = lookupValue Then
HLook = cell.Offset(Row - 1, 0)
Exit Function
End If
Next cell
End Function






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Looking up values

OoooooooooooooooK

"Nathan Carroll" wrote in message
...
I find vlookup and hlookup to finicky.


"Don Guillett" wrote in message
...
Maybe you need to add application.volatile but

Why are you re-inventing the wheel?

"Nathan Carroll" wrote in message
...
The following two function work for looking up a value but if I make a
change to the Row/Column that contains the lookup value my lookup

value
does
not change. I have my sheet on automatic calculate. Should these

function
types be ranges?


Function VLook(lookupValue As Range, LookupRange As Range, Column As
Integer) As Double
Dim cell As Range
For Each cell In LookupRange
If cell = lookupValue Then
VLook = cell.Offset(0, Column - 1)
End If
Next cell
End Function

Function HLook(lookupValue As Range, LookupRange As Range, Row As

Integer)
As Double
Dim cell As Range
For Each cell In LookupRange
If cell = lookupValue Then
HLook = cell.Offset(Row - 1, 0)
Exit Function
End If
Next cell
End Function








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
calculate values in an unlimited range of cells in a column WITHOUTalso calculating values that had previously been filtered AGAINST? yadang Excel Discussion (Misc queries) 2 October 1st 09 06:18 PM
Excel 2007 doesnt show Y-axis values when the values are small. outback Charts and Charting in Excel 2 October 26th 08 01:37 AM
Exclude #N/A values and Return Numeric values to consecutive cells in Single Row Sam via OfficeKB.com Excel Worksheet Functions 5 February 9th 08 03:07 AM
Advanced Filter for Values in Column M greater than Values in Colu SteveC Excel Discussion (Misc queries) 3 May 2nd 06 07:55 PM
Predict Y-values on new X-values based on other actual X and Y values? NorTor Excel Programming 2 August 10th 03 03:08 PM


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

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"