List if conditions met

ddub25

Well-known Member
Joined
Jan 11, 2007
Messages
586
Code:
A	B	C
1	ON	1
2	OFF	3
3	ON	4
4	ON	
5	OFF	
6	OFF	
7	OFF	
8	OFF	
9	OFF	
10	OFF

Column A is a list of numbers that are either turned ON or OFF.

Column B indicates whether they are turned ON or OFF. As you can see, numbers 1, 3 and 4 are turned ON.

Column C lists the numbers that are currently turned ON. Can anyone help with a formula for Column C that will list these numbers that are turned ON in a consecutive manner?
 
Last edited:

Some videos you may like

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Weazel

Well-known Member
Joined
Dec 24, 2011
Messages
3,155
maybe something like...

=IFERROR(INDEX($A$1:$A$10,AGGREGATE(15,6,$A$1:$A$10/($B$1:$B$10="on"),ROWS($C$1:C1))),"")
 

ddub25

Well-known Member
Joined
Jan 11, 2007
Messages
586
It must be equating to an error when I use that formula as all cells in Column C are empty. Any ideas why it is not outputting 1,3 and 4 in C1, C2, C3 respectively?
 

Weazel

Well-known Member
Joined
Dec 24, 2011
Messages
3,155
not sure what the issue might be because its working for me...

C2=IFERROR(INDEX($A$1:$A$10,AGGREGATE(15,6,$A$1:$A$10/($B$1:$B$10="on"),ROWS($C$1:C1))),"")


you can try using

=IFERROR(INDEX($A$1:$A$10,SMALL(IF($B$1:$B$10="ON",ROW($A$1:$A$10)-ROW($A$1)+1),ROWS($D$1:D1))),"") control shift enter

as an alternative

Row\Col
A​
B​
C​
1​
1ON
1​
2​
2OFF
3​
3​
3ON
4​
4​
4ON
5​
5OFF
6​
6OFF
7​
7OFF
8​
8OFF
9​
9OFF
10​
10OFF

<tbody>
</tbody>
 

Watch MrExcel Video

Forum statistics

Threads
1,122,842
Messages
5,598,396
Members
414,235
Latest member
sucosama

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
Top