Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default .find =< function

is there a function that will find an equal to or less than value (entries
will be numeric only, and sorted descending)?

similar to
Set c = Worksheets(2).Range("B1:B10").Find(What:=Qnty, LookIn:=xlValues,
lookat:=xlWhole)

however:
xlWhole and xlPart are not appropriate arguments...

as always, thanks in advance,
-mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default .find =< function

"What" argument of find only takes an exact match (as qualified by xlWhole
and xlPart).

You would need to loop through the range and make a determination on each
cell.

Or, Use an Autofilter and filter on your criteria.

Not sure what you mean by sorted descending?

After you get the list of values you want to make a list and sort it
descending?

If you used an autofilter, you could just sort the visible cells using the
built in sort functionality

--
Regards,
Tom Ogilvy


"mark kubicki" wrote in message
...
is there a function that will find an equal to or less than value (entries
will be numeric only, and sorted descending)?

similar to
Set c = Worksheets(2).Range("B1:B10").Find(What:=Qnty,

LookIn:=xlValues,
lookat:=xlWhole)

however:
xlWhole and xlPart are not appropriate arguments...

as always, thanks in advance,
-mark




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default .find =< function

sorry - misread what you meant by sort descending. Nonetheless, the answers
are good unless you are sure that the value you want to be less than is
located in the sorted list. In that case, you could use find to get that
cell, then loop down until you found the next cell that does not equal that
value, then take all below that.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
"What" argument of find only takes an exact match (as qualified by xlWhole
and xlPart).

You would need to loop through the range and make a determination on each
cell.

Or, Use an Autofilter and filter on your criteria.

Not sure what you mean by sorted descending?

After you get the list of values you want to make a list and sort it
descending?

If you used an autofilter, you could just sort the visible cells using the
built in sort functionality

--
Regards,
Tom Ogilvy


"mark kubicki" wrote in message
...
is there a function that will find an equal to or less than value

(entries
will be numeric only, and sorted descending)?

similar to
Set c = Worksheets(2).Range("B1:B10").Find(What:=Qnty,

LookIn:=xlValues,
lookat:=xlWhole)

however:
xlWhole and xlPart are not appropriate arguments...

as always, thanks in advance,
-mark






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default .find =< function

Find will look for specific things. This is not appropriate for your
purposes... Try something more like (untested but it should be close)

dim rng as range

set rng = sheet1.range("A65536").end(xlup)

do while rng.value < Qnty
set rng = rng.offset(0, -1)
loop

msgbox rng.address
--
HTH...

Jim Thomlinson


"mark kubicki" wrote:

is there a function that will find an equal to or less than value (entries
will be numeric only, and sorted descending)?

similar to
Set c = Worksheets(2).Range("B1:B10").Find(What:=Qnty, LookIn:=xlValues,
lookat:=xlWhole)

however:
xlWhole and xlPart are not appropriate arguments...

as always, thanks in advance,
-mark



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default .find =< function

Mark,

In Excel Help take a look at Lookup, and Vlookup.
I think it will do this for you...

Dim c ' as Long, or Integer, or.....

c = Worksheetfunction.VLOOKUP(Qnty,Sheets(2).Range("B1 :B10"),1,True)


as an alternative - look at Match()

but be careful - these error out if a value isn't found.

--
steveB

Remove "AYN" from email to respond
"mark kubicki" wrote in message
...
is there a function that will find an equal to or less than value (entries
will be numeric only, and sorted descending)?

similar to
Set c = Worksheets(2).Range("B1:B10").Find(What:=Qnty,
LookIn:=xlValues,
lookat:=xlWhole)

however:
xlWhole and xlPart are not appropriate arguments...

as always, thanks in advance,
-mark






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default .find =< function

From help on Vlookup for the 4th argument being True:

---------
a.. If TRUE or omitted, an exact or approximate match is returned. If an
exact match is not found, the next largest value that is less than
lookup_value is returned.
The values in the first column of table_array must be placed in ascending
sort order; otherwise, VLOOKUP may not give the correct value. You can put
the values in ascending order by choosing the Sort command from the Data
menu and selecting Ascending.

----------

Since the data is Descending, then Vlookup would not work. On the other
hand, Match can handle this - see Excel VBA help for details.



--

Regards,

Tom Ogilvy



"STEVE BELL" wrote in message
news:dOOJe.271$7d.130@trnddc08...
Mark,

In Excel Help take a look at Lookup, and Vlookup.
I think it will do this for you...

Dim c ' as Long, or Integer, or.....

c = Worksheetfunction.VLOOKUP(Qnty,Sheets(2).Range("B1 :B10"),1,True)


as an alternative - look at Match()

but be careful - these error out if a value isn't found.

--
steveB

Remove "AYN" from email to respond
"mark kubicki" wrote in message
...
is there a function that will find an equal to or less than value

(entries
will be numeric only, and sorted descending)?

similar to
Set c = Worksheets(2).Range("B1:B10").Find(What:=Qnty,
LookIn:=xlValues,
lookat:=xlWhole)

however:
xlWhole and xlPart are not appropriate arguments...

as always, thanks in advance,
-mark






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
#VALUE about function Find hui Excel Worksheet Functions 14 September 12th 06 04:01 PM
Find Function Guy Lydig Excel Discussion (Misc queries) 2 May 19th 06 07:19 PM
Find Function Mark Excel Programming 4 February 15th 05 02:16 AM
Find function Jahunga Excel Worksheet Functions 2 November 22nd 04 03:38 PM
backwards find function to find character in a string of text Ashleigh K. Excel Programming 1 January 14th 04 04:36 PM


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