View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default How to find first row where condition is true?

Ah, so. Dismiss my earlier help attempt which is clearly below your
expertise level. I have no further comments.
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:25,000 Files:300 Subscribers:70
xdemechanik
---
"WhatsUp31415" wrote in message
...
"Max" wrote:
I took the liberty to add an additional logic check that col K is not
empty, which IMO makes your original OR intents more meaningful


Why? Rhetorical question. Only I can determine the "meaningfulness" of
conditions to test. In this case, K2:K4888 is fully populated, just as
columns H, I and J are. So the extra condition is irrelevant


In N2: =--AND(K2<"",OR(H2<K2,I2<K2,J2<K2))
Copy down. Leave N1 empty.
[....]
Then you could use in say, M2: =MATCH(1,N:N,0)


Well, if I wanted to use helper cells, I would simply use
=OR(H2<K2,I2<K2,J2<K2), as I did in my original posting.
Computationally more efficient.

And I would use =ROW(M1)+MATCH(TRUE,M2:M4888,0) because I want the row
number, not simply the array index. I use ROW so that the formula is
updated automagically if I insert rows above.


Above helps in some way?


Not really. I asked for a formula, if possible. If that's not possible,
an explanation of why not would be helpful.

I guess the reason that my formula failed is that OR accepts an array
argument, which foils my attempt to have the formula interpreted as:
MIN({IF(OR(H2<K2,I2<K2,J2<K2),ROW(G2),
IF(OR(H3<K3,I3<K3,J3<K3),ROW(G3), ...}).

Having realized that, I simply need to use an alternative for OR. The
following does the job:

=MIN(IF((H3:H4889<K3:K4889)+(I3:I4889<K3:K4889)+ (J3:J4889<K3:K4889),ROW(G3:G4889)))

(Sorry for the row numbering change. I inserted a row.)