Finding a row based on a random value in a column

B

bobzebra

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

(e-mail address removed)
 
B

Biff

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
 
R

Ragdyer

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))
 
B

bobzebra

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top