View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Max
 
Posts: n/a
Default Read list of cells; conditional

"asianmike" wrote:
I'm trying to find a way to read a list of cells and if the value in the
cell equals a specific value then print out something if not than skip
that element and go to the next one. Clarification: only print out
element that fit a certain conditional. I do not want a lot of bunch of
"false" cells or blank cells and I don't want to use just a filter. If a
macro is involved please be gentle as I know very little about macros.


Here's a simple example using non-array formulas ..

Assume the source data below is in A1:B10,
and we want to extract only the text within col B
for which col A = 2 (say), in the same order that these appear in col B

2 Text1
1 Text2
2 Text3
1 Text4
2 Text5
2 Text6
3 Text7
3 Text8
1 Text9
3 Text10

Put in C1:
=IF(ISERROR(SMALL(D:D,ROW(A1))),"",
INDEX(B:B,MATCH(SMALL(D:D,ROW(A1)),D:D,0)))

Put in D1:
=IF(A1="","",IF(A1=2,ROW(),""))
(this is the criteria part)

Select C1:D1, copy down to D10

Col C will return the required results, all neatly bunched
at the top, w/o any intervening blank rows, viz.:

Text1
Text3
Text5
Text6

(Col D is the criteria col)
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---