Array depending on 2 variables

hond70

Board Regular
Joined
Apr 13, 2004
Messages
72
I have the following sheet https://1drv.ms/x/s!Ai6fM6lT5gt6h0vP6kgG5MmfsdsU

It consists of a table that is populated by a list (with an array). The last column of the table is based on a value in B21.

Goal: I want to populate a second table based on the value in B21 and based on the last column of the table:

1. When there is only the value "red" in last column of the table: copy table 1 to table 2 (value of B21 doesn't matter)
2. When there is a mix of the values "red" and "green": filter on the value of B21

Any help is greatly appreciated!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Please try at C15:F18

=INDEX(C$3:C$12,IF(COUNTIF($F$3:$F$12,$B$21),AGGREGATE(15,6,ROW(C$3:C$12)-ROW(C$2)/($F$3:$F$12=$B$21),ROWS(C$15:C15)),ROWS(C$15:C15)))
 
Upvote 0
Thanks, but I cannot enter the array. Is something wrong with it? Could you please try in the above mentioned sheet? See C31
 
Upvote 0
You did it without an array!
Unfortunately it collapses when I changed F5 to green (same situation as scenario 3). At the end of the formula it says ROWS(I$28:I29). That can't be right, does it?
 
Upvote 0
I did it myself: =IFERROR(IF($AD$13=0;INDEX($AA$3:$AA$12; SMALL(IF($AD$3:$AD$12="red";ROW($AD$3:$AD$12)-ROW($AD$3)+1);ROWS($AD$3:$AD3)));INDEX($AA$3:$AA$12; SMALL(IF($AD$3:$AD$12=$AC$27;ROW($AD$3:$AD$12)-ROW($AD$3)+1);ROWS($AD$3:$AD3))));"")
Where AD13 =COUNTIF(AD3:AD12;"green")
 
Upvote 0

Forum statistics

Threads
1,223,719
Messages
6,174,089
Members
452,542
Latest member
Bricklin

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