View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default Displaying multiple non-adjacent cells with 1 criteria

"Bernie Deitrick" <deitbe @ consumer dot org wrote...
On sheet 2 in cell A1 to D1, enter 4, 6, 27, 28 *(These are the column numbers of the data you want
to "extract" *Then in E1, enter 50000.

In cell A2:D2, enter your headings "Vendor", "Value", "Month", "Year"
In cell A3, array enter (enter using Ctrl-Shift-Enter)

=INDIRECT("'Data'!" & ADDRESS(LARGE((Data!$F$2:$F$1000=$E$1)
*ROW(Data!$D$2:$D$1000),COUNTIF(Data!F$2:$F$1000, "=" & $E$1) +ROW($A$3)-ROW()),A$1))

....

Where to start?!

The ever popular but unnecessary and inefficient INDIRECT(ADDRESS
(...)).

The pointless use of LARGE(.,constant-ROW()) instead of SMALL(.,ROWS
(.)).


Avoid volatile functions. Strive for efficiency. Try

A3 [array formula]:
=INDEX(Data!$A$1:$AB$1000,SMALL(IF(Data!$F$2:$F$10 00=$E$1,ROW(Data!$F
$2:$F$1000)),ROWS(A$3:A3)),A$1)


More efficient still would be using the OP's column AC and an extra
supporting formula for each result record. Using column X for the
supporting calculations,

X3:
=MATCH(1,Data!$AC$2:$AC$1000,0)

A3:
=IF(COUNT($X3),INDEX(Data!$A$2:$AB$1000,$X3,A$1)," ")

Fill A3 right into B3:D3.

X4:
=MATCH(1,INDEX(Data!$AC$2:$AC$1000,X3+1):Data!$AC$ 1000,0)+X3

Fill X4 down as far as needed. Fill A3:D3 down as far as needed.