Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
829 views
in Technique[技术] by (71.8m points)

excel - Doing an array formula lookup

I have a list of data like this:

Name   |    Number
Bob    |   300
Joe    |   200
Jane   |   400
Sisqo  |   450
Jill   |   500

There's about 62 rows of this, all numbers which can be different, some repeated. My goal is to basically add a column which contains all the list of people who are at 400 or above. So that it looks like this:

Name  
Jane 
Sisqo 
Jill  

What I have is:

{=iferror(INDEX($A$2:$B$6, SMALL(IF($B$2:$B$6 >= 400, $B$2:$B$6,), ROW(1:1)), 1), "")}

What I imagine this is doing: 1) The small function is looking in range b2:b6, and because this is an array formula, looks at each cell in B2:B6 to see if its greater or equal to 400. 2) I don't know exactly how, but I hope that the row function is finding the array of b2:b6 only if the value in the cell under consideration is greater than or equal to 400. If it doesn't find anything, nothing happens. 3) Then it runs the comparison small(b2:b6, 1) for the lowest value in that range. Then when copied down, because I'm using the row() function, it will be small(b2:b6, 2), small(b2:b6, 3) and so on.

At this point the row of the lowest number at 400 or below should be found.

So then the index function should read

index(a2:b6, 3, 1)

for the first one.Except I'm only getting

Name
Bob Bob

So where is the error?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I prefer to use MATCH in an Array form:

=IFERROR(INDEX($A$2:$A$6,MATCH(1,(COUNTIFS($E$1:E1,$A$2:$A$6)=0)*($B$2:$B$6>=400),0)),"")

Being an array formula it must be confirmed with Ctrl-shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put {} around the formula.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...