Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Hlookup, but to next highest value

Hi All,

I'm using vba to enter the following code into some cells programatically:
Range(strHlookupCell).Value = "=HLOOKUP(A3,TCtl_DateRange,1,TRUE)".
where strHlookupCell = Sheet "PData" Range N3;
and TCtl_DataRange = Sheets "Control" Range B5:BA5

TCtl_DataRange is a listing of dates incrementing by 1 week.
What i need to be able to do, is look at cell A3 which is a date, and lookup
the TCtl_DataRange and find the next highest match. Not all values in A3 will
match perfectly to a value in TClt_DataRange.

Is there a way to lookup the value in A3 and return either an exact match,
or return the next highest value?

The code im using returns the closest value, not the next highest value.

Thanks.

Tones.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Hlookup, but to next highest value


Tony
To find a match of A3 or next highest value:

=INDEX(TctL_dateRange,MATCH(A3,TctL_dateRange)+NOT (INDEX(TctL_dateRange,MATCH(F1,TctL_dateRange))=A3 ))

Don Pistulka

"Tony Zappal" wrote in message
...
Hi All,

I'm using vba to enter the following code into some cells programatically:
Range(strHlookupCell).Value = "=HLOOKUP(A3,TCtl_DateRange,1,TRUE)".
where strHlookupCell = Sheet "PData" Range N3;
and TCtl_DataRange = Sheets "Control" Range B5:BA5

TCtl_DataRange is a listing of dates incrementing by 1 week.
What i need to be able to do, is look at cell A3 which is a date, and
lookup
the TCtl_DataRange and find the next highest match. Not all values in A3
will
match perfectly to a value in TClt_DataRange.

Is there a way to lookup the value in A3 and return either an exact match,
or return the next highest value?

The code im using returns the closest value, not the next highest value.

Thanks.

Tones.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Hlookup, but to next highest value

Thank you heaps Don.
It works great.
I had no idea about the index function.

Cheers.
Tones.

"Don" wrote:


Tony
To find a match of A3 or next highest value:

=INDEX(TctL_dateRange,MATCH(A3,TctL_dateRange)+NOT (INDEX(TctL_dateRange,MATCH(F1,TctL_dateRange))=A3 ))

Don Pistulka

"Tony Zappal" wrote in message
...
Hi All,

I'm using vba to enter the following code into some cells programatically:
Range(strHlookupCell).Value = "=HLOOKUP(A3,TCtl_DateRange,1,TRUE)".
where strHlookupCell = Sheet "PData" Range N3;
and TCtl_DataRange = Sheets "Control" Range B5:BA5

TCtl_DataRange is a listing of dates incrementing by 1 week.
What i need to be able to do, is look at cell A3 which is a date, and
lookup
the TCtl_DataRange and find the next highest match. Not all values in A3
will
match perfectly to a value in TClt_DataRange.

Is there a way to lookup the value in A3 and return either an exact match,
or return the next highest value?

The code im using returns the closest value, not the next highest value.

Thanks.

Tones.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Hlookup, but to next highest value

Glad I could help

Don

"Tony Zappal" wrote in message
...
Thank you heaps Don.
It works great.
I had no idea about the index function.

Cheers.
Tones.

"Don" wrote:


Tony
To find a match of A3 or next highest value:

=INDEX(TctL_dateRange,MATCH(A3,TctL_dateRange)+NOT (INDEX(TctL_dateRange,MATCH(F1,TctL_dateRange))=A3 ))

Don Pistulka

"Tony Zappal" wrote in message
...
Hi All,

I'm using vba to enter the following code into some cells
programatically:
Range(strHlookupCell).Value = "=HLOOKUP(A3,TCtl_DateRange,1,TRUE)".
where strHlookupCell = Sheet "PData" Range N3;
and TCtl_DataRange = Sheets "Control" Range B5:BA5

TCtl_DataRange is a listing of dates incrementing by 1 week.
What i need to be able to do, is look at cell A3 which is a date, and
lookup
the TCtl_DataRange and find the next highest match. Not all values in
A3
will
match perfectly to a value in TClt_DataRange.

Is there a way to lookup the value in A3 and return either an exact
match,
or return the next highest value?

The code im using returns the closest value, not the next highest
value.

Thanks.

Tones.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Hlookup, but to next highest value

My Bad

I meant to change the F1 to A3, like this:

=INDEX(TctL_dateRange,MATCH(A3,TctL_dateRange)+NOT (INDEX(TctL_dateRange,MATCH(A3,TctL_dateRange))=A3 ))

Don Pistulka

"Don" wrote in message
...

Tony
To find a match of A3 or next highest value:

=INDEX(TctL_dateRange,MATCH(A3,TctL_dateRange)+NOT (INDEX(TctL_dateRange,MATCH(F1,TctL_dateRange))=A3 ))

Don Pistulka

"Tony Zappal" wrote in message
...
Hi All,

I'm using vba to enter the following code into some cells
programatically:
Range(strHlookupCell).Value = "=HLOOKUP(A3,TCtl_DateRange,1,TRUE)".
where strHlookupCell = Sheet "PData" Range N3;
and TCtl_DataRange = Sheets "Control" Range B5:BA5

TCtl_DataRange is a listing of dates incrementing by 1 week.
What i need to be able to do, is look at cell A3 which is a date, and
lookup
the TCtl_DataRange and find the next highest match. Not all values in A3
will
match perfectly to a value in TClt_DataRange.

Is there a way to lookup the value in A3 and return either an exact
match,
or return the next highest value?

The code im using returns the closest value, not the next highest value.

Thanks.

Tones.





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
highest second highest and third highest ernie Excel Discussion (Misc queries) 3 March 15th 10 02:27 PM
Highest Value vlook fomula Excel Discussion (Misc queries) 9 October 15th 09 04:42 PM
Display the Highest, Second Highest, Third Highest and so on... gkb Excel Discussion (Misc queries) 7 December 1st 06 10:45 PM
2 rows, highest No in row 1, then highest number in row 2 relating to that column, possible duplicates John Excel Worksheet Functions 3 August 11th 06 04:34 AM
second highest value Pivotrend Excel Discussion (Misc queries) 6 February 21st 06 07:12 PM


All times are GMT +1. The time now is 12: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"