Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Find first value in range

I'm trying to do the following:
Offset(A15, ____, -5)

where _____ is a function that says look at the range (B3:B20) and
return a reference to the first value that is greater than zero. I'd
rather not create vba code behind it, but will if I have absolutely
have to. Is there any way to see what is the first value in a range
that is greater than o?

  #2   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Find first value in range

Ok, I just found some code that works, now I just need an explanation
of how it works:
{=MATCH(1,--(RANGE0),0)}
This works perfectly, but I have no idea why. Can someone walk me
through what it's doing?

  #3   Report Post  
Posted to microsoft.public.excel.misc
Toppers
 
Posts: n/a
Default Find first value in range

This is an array formula (entered using Shift+Ctrl+Enter).

It "looks" through each cell in the range and if it is 0, sets a value of
1 (this is what the -- does, converting TRUE/FALSE to 1/0). So we end up with
an "internal" array of 1s and 0s corresponding to cells in the range.

tMATCH then matches the "1" (as search argument) to find the first "1" (one
) in the range(internal array) and returns the position. MATCH always returns
the first occurence of the search argument.

HTH

" wrote:

Ok, I just found some code that works, now I just need an explanation
of how it works:
{=MATCH(1,--(RANGE0),0)}
This works perfectly, but I have no idea why. Can someone walk me
through what it's doing?


  #4   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Find first value in range

Fantastic. Thanks, that makes perfect sense. So if I didn't do the
--, I would have had to match on TRUE or FALSE then correct? Thanks so
much for the help.
Toppers wrote:
This is an array formula (entered using Shift+Ctrl+Enter).

It "looks" through each cell in the range and if it is 0, sets a value of
1 (this is what the -- does, converting TRUE/FALSE to 1/0). So we end up with
an "internal" array of 1s and 0s corresponding to cells in the range.

tMATCH then matches the "1" (as search argument) to find the first "1" (one
) in the range(internal array) and returns the position. MATCH always returns
the first occurence of the search argument.

HTH

" wrote:

Ok, I just found some code that works, now I just need an explanation
of how it works:
{=MATCH(1,--(RANGE0),0)}
This works perfectly, but I have no idea why. Can someone walk me
through what it's doing?



  #5   Report Post  
Posted to microsoft.public.excel.misc
Biff
 
Posts: n/a
Default Find first value in range

So if I didn't do the --, I would have had to
match on TRUE or FALSE then correct?


Correct

Biff

wrote in message
oups.com...
Fantastic. Thanks, that makes perfect sense. So if I didn't do the
--, I would have had to match on TRUE or FALSE then correct? Thanks so
much for the help.
Toppers wrote:
This is an array formula (entered using Shift+Ctrl+Enter).

It "looks" through each cell in the range and if it is 0, sets a value
of
1 (this is what the -- does, converting TRUE/FALSE to 1/0). So we end up
with
an "internal" array of 1s and 0s corresponding to cells in the range.

tMATCH then matches the "1" (as search argument) to find the first "1"
(one
) in the range(internal array) and returns the position. MATCH always
returns
the first occurence of the search argument.

HTH

" wrote:

Ok, I just found some code that works, now I just need an explanation
of how it works:
{=MATCH(1,--(RANGE0),0)}
This works perfectly, but I have no idea why. Can someone walk me
through what it's doing?





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
Excel auto filtering to find a range of dates in a list Candy Excel Discussion (Misc queries) 2 January 31st 06 02:32 PM
Search range of cells, find a value, output adjoining cell. How? nyys Excel Worksheet Functions 3 January 5th 06 01:48 PM
Match function...random search? Les Excel Worksheet Functions 10 July 28th 05 11:54 AM
How to Select a relative range with Using "Find" and Offset() Dennis Excel Discussion (Misc queries) 7 July 27th 05 03:57 PM
I need a formula to find rows within a date range in one column? M. Penney Excel Worksheet Functions 5 May 12th 05 12:32 AM


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