close

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

Hi!

One way:

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

=IF(COUNTIF(B2:B7,quot;lt;0quot;),MATCH(TRUE,B2:B7lt;0,0) 1,quot;quot; )

Biff

quot;bobzebraquot; gt; wrote in message oups.com...
gt; First, apologies if this has been answered before but I couldn't find
gt; anything close in the forums:
gt;
gt; My problem is I need to find the first row reference if a value in one
gt; of the columns is (unpredictably) less than 0. I have tried a mix of
gt; Index, Match and the Excel lookup wizard but to no avail.
gt;
gt; For example, at its simplest I have 2 columns x and y
gt;
gt; A B
gt; 1 x y
gt; 2 1 13
gt; 3 2 6
gt; 4 3 0
gt; 5 4 -1
gt; 6 5 -12
gt; 7 6 4
gt; etc
gt;
gt; how do I locate the first row when the y column goes negative. I know
gt; it is simple if I know beforehand ( in this case it is row cell A5) ,
gt; but if the Y column varies at random, I get stuck. Any help much
gt; appreciated
gt; Bob
gt;
gt;
gt;
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:B7lt;0,0))

--
Array formulas must be entered with CSE, lt;Ctrlgt; lt;Shift gt; lt;Entergt;, instead of
the regular lt;Entergt;, 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 !
---------------------------------------------------------------------------
quot;bobzebraquot; gt; wrote in message oups.com...
gt; First, apologies if this has been answered before but I couldn't find
gt; anything close in the forums:
gt;
gt; My problem is I need to find the first row reference if a value in one
gt; of the columns is (unpredictably) less than 0. I have tried a mix of
gt; Index, Match and the Excel lookup wizard but to no avail.
gt;
gt; For example, at its simplest I have 2 columns x and y
gt;
gt; A B
gt; 1 x y
gt; 2 1 13
gt; 3 2 6
gt; 4 3 0
gt; 5 4 -1
gt; 6 5 -12
gt; 7 6 4
gt; etc
gt;
gt; how do I locate the first row when the y column goes negative. I know
gt; it is simple if I know beforehand ( in this case it is row cell A5) ,
gt; but if the Y column varies at random, I get stuck. Any help much
gt; appreciated
gt; Bob
gt;
gt;
gt;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

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()