Selection array

hond70

Board Regular
Joined
Apr 13, 2004
Messages
72
Hi,

I have a table that is dynamically created.

........S.............T............U...........V
3......apple........45.........24..........red
4......pear..........10.........26.........red
...
12.....banana.....13.........23.........red

Column V can be either red or green.

A second table has to show only the rows where V = green
But when there is row where V is green (like in the example above), then it has to show all the rows

I now use the following array
{=IFERROR(INDEX($S$3:$S$12; SMALL(IF(COUNTIF($U$26; $V$3:$V$12); ROW($S$3:$S$12)-MIN(ROW($S$3:$S$12))+1); ROW(A1)); COLUMN(A1));"")}

U26 contains either red of green

The array works when V contains red and green rows. It returns an empty cell if U26 contains green and the first table does not have a row with green.
So if U26 = green then in the example above the formula doesn't work. If U26 = red it returns all the cells (like it should).
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I may have to explain myself better.

Scenario 1:

........S.............T............U...........V
3......apple........45.........24..........red
4......pear..........10.........26.........red
...
12.....banana.....13.........23.........red

Scenario 2:

........S.............T............U...........V
3......apple........45.........24..........green
4......pear..........10.........26..........green
...
12.....banana.....13.........23.........red

U26 can be green or red.
When there is no green in column V (scenario 1) then the second table should be a copy of the first table (no filter)
When there is 1 or more green in column V (scenario 2) then the second table should only show the green rows (row 1 and 2)
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

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