Extract multiple rows using a single criteria

danhodges99

New Member
Joined
Apr 22, 2009
Messages
12
Hi,

I have the following example data:

ABCDE
Include?DateChannelEventViewers
18/01/17Channel 1TeamA v TeamB50,000
18/01/17Channel 2TeamC v TeamD75,000
Include19/01/17Channel 1TeamA v TeamE100,000
Include19/01/17Channel 2TeamB v TeamD98,000
Include19/01/17Channel 3TeamF v TeamH25,000
Include19/01/17Channel 1TeamC v TeamJ1,000
19/01/17Channel 2TeamZ v TeamR563
20/01/17Channel 3TeamG v TeamK24,500

<tbody>
</tbody>

I need to extract only the lines which are tagged to be included in column A into a separate table. I know I can obviously do this via a filter, but need to significantly re-format so filtering is not appropriate.

The final report would ideally look something like this:

EventChannelViewers
TeamA v TeamEChannel 1100,000
TeamB v TeamDChannel 298,000
TeamF v TeamHChannel 325,000
TeamC v TeamJChannel 11,000

<tbody>
</tbody>

I can obviously use VLOOKUP to return the first matching row, but I'm getting stuck trying to feed all the other matches into the report table - any help much appreciated!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Here is one way.
Note: the IFERROR and AGGREGATE function are only available in Excel 2010 and higher. If you have a ver. before 2010 let us known.

Formula in A14 for Row ID would be copied down.
Formula in B14 would be dragged down and across as needed.
Excel Workbook
ABCDE
1Include?DateChannelEventViewers
218/01/17Channel 1TeamA v TeamB50,000
318/01/17Channel 2TeamC v TeamD75,000
4Include19/01/17Channel 1TeamA v TeamE100,000
5Include19/01/17Channel 2TeamB v TeamD98,000
6Include19/01/17Channel 3TeamF v TeamH25,000
7Include19/01/17Channel 1TeamC v TeamJ1,000
819/01/17Channel 2TeamZ v TeamR563
920/01/17Channel 3TeamG v TeamK24,500
10
11
12
13Row IDEventChannelViewers
143TeamA v TeamEChannel 1100000
154TeamB v TeamDChannel 298000
165TeamF v TeamHChannel 325000
176TeamC v TeamJChannel 11000
18
Sheet
 
Upvote 0
Here's a version that doesn't use AGGREGATE.

ABCDEFGHIJK
1Include?DateChannelEventViewersRowEventChannelViewers
218/01/17Channel 1TeamA v TeamB50,0004TeamA v TeamEChannel 1100000
318/01/17Channel 2TeamC v TeamD75,0005TeamB v TeamDChannel 298000
4Include19/01/17Channel 1TeamA v TeamE100,0006TeamF v TeamHChannel 325000
5Include19/01/17Channel 2TeamB v TeamD98,0007TeamC v TeamJChannel 11000
6Include19/01/17Channel 3TeamF v TeamH25,000
7Include19/01/17Channel 1TeamC v TeamJ1,000
819/01/17Channel 2TeamZ v TeamR563
920/01/17Channel 3TeamG v TeamK24,500

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
I2=IF($H2="","",INDEX($D:$D,$H2))
J2=IF($H2="","",INDEX($C:$C,$H2))
K2=IF($H2="","",INDEX($E:$E,$H2))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
H2{=IFERROR(SMALL(IF($A$2:$A$9="Include",ROW($A$2:$A$9)),ROWS($H$2:$H2)),"")}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



The ROW column is designed to perform common calculations once, so that the other columns calculate quicker. You can hide the Row column after you enter the formula.

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,221,811
Messages
6,162,109
Members
451,743
Latest member
matt3388

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top