Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
bobzebra
 
Posts: n/a
Default Finding a row based on a random value in a column

First, apologies if this has been answered before but I couldn't find
anything close in the forums:

My problem is I need to find the first row reference if a value in one
of the columns is (unpredictably) less than 0. I have tried a mix of
Index, Match and the Excel lookup wizard but to no avail.

For example, at its simplest I have 2 columns x and y

A B
1 x y
2 1 13
3 2 6
4 3 0
5 4 -1
6 5 -12
7 6 4
etc

how do I locate the first row when the y column goes negative. I know
it is simple if I know beforehand ( in this case it is row cell A5) ,
but if the Y column varies at random, I get stuck. Any help much
appreciated
Bob



  #2   Report Post  
Posted to microsoft.public.excel.misc
Biff
 
Posts: n/a
Default Finding a row based on a random value in a column

Hi!

One way:

Entered as an array using the key combo of CTRL,SHIFT,ENTER:

=IF(COUNTIF(B2:B7,"<0"),MATCH(TRUE,B2:B7<0,0)+1,"" )

Biff

"bobzebra" wrote in message
oups.com...
First, apologies if this has been answered before but I couldn't find
anything close in the forums:

My problem is I need to find the first row reference if a value in one
of the columns is (unpredictably) less than 0. I have tried a mix of
Index, Match and the Excel lookup wizard but to no avail.

For example, at its simplest I have 2 columns x and y

A B
1 x y
2 1 13
3 2 6
4 3 0
5 4 -1
6 5 -12
7 6 4
etc

how do I locate the first row when the y column goes negative. I know
it is simple if I know beforehand ( in this case it is row cell A5) ,
but if the Y column varies at random, I get stuck. Any help much
appreciated
Bob





  #3   Report Post  
Posted to microsoft.public.excel.misc
Ragdyer
 
Posts: n/a
Default Finding a row based on a random value in a column

Since you mentioned A5, are you looking for the return to come from Column
A?
If so, try this *array* formula:

=INDEX(A1:A7,MATCH(TRUE,B1:B7<0,0))

--
Array formulas must be entered with CSE, <Ctrl <Shift <Enter, instead of
the regular <Enter, which will *automatically* enclose the formula in curly
brackets, which *cannot* be done manually.
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"bobzebra" wrote in message
oups.com...
First, apologies if this has been answered before but I couldn't find
anything close in the forums:

My problem is I need to find the first row reference if a value in one
of the columns is (unpredictably) less than 0. I have tried a mix of
Index, Match and the Excel lookup wizard but to no avail.

For example, at its simplest I have 2 columns x and y

A B
1 x y
2 1 13
3 2 6
4 3 0
5 4 -1
6 5 -12
7 6 4
etc

how do I locate the first row when the y column goes negative. I know
it is simple if I know beforehand ( in this case it is row cell A5) ,
but if the Y column varies at random, I get stuck. Any help much
appreciated
Bob




  #4   Report Post  
Posted to microsoft.public.excel.misc
bobzebra
 
Posts: n/a
Default Finding a row based on a random value in a column

Guys: brilliant many thanks; works a treat. More importantly you have
opened door on Array formulas. I simply hadn't reaslied they existed in
Excel. But I suppose without a first example it doesn't naturally occur
to you that they may solve your problem.
thanks again.

Bob

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
Need to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
move contents of column C based on criteria related to column A Debra Excel Discussion (Misc queries) 2 December 27th 05 10:25 PM
"Cumulative" column based on a pivot table sum column? Robert Day Excel Worksheet Functions 2 December 15th 05 09:20 PM
Running total w/2 columns - Excel Anna / Ideal Excel Worksheet Functions 14 August 10th 05 04:28 PM
Calculating totals in a column based on a lookup in another column Michael Wright via OfficeKB.com Excel Worksheet Functions 1 April 15th 05 09:52 AM


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