Help extracting selected rows from a table

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,525
Office Version
  1. 365
Platform
  1. Windows
Suppose I have a table like the one on the left. Is there a way I can create another table like the one on the right containing just the rows with "Yes" in the Tax column? Thanks

Donations & RMD.xlsx
BCDEFGHIJKLMN
5DateAccountCheck#ToAmountTax?DateAccountCheck#ToAmountTax?
601/23/21Brokerage1443Checking$100.00No02/14/21SEP-IRA43-255-1276Red Cross$75.00Yes
702/03/21Checking2384Girl Scout Cookies$50.00No06/12/21Brokerage1444NPR$150.00Yes
802/14/21SEP-IRA43-255-1276Red Cross$75.00Yes07/09/21SEP-IRA67-003-9202Molly's School$500.00Yes
903/22/21Checking2385Johnny's Auto$125.00No
1004/15/21Checking2386Grandma$200.00No
1106/12/21Brokerage1444NPR$150.00Yes
1207/09/21SEP-IRA67-003-9202Molly's School$500.00Yes
1308/12/21Checking2387Disneyland$250.00No
MrExcel3
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I see you have 365 - have you considered using the Filter() function? You can put the formula into a singe cell - I6 for the desired result.

Cars.xlsb
BCDEFGHIJKLMN
5DateAccountCheck#ToAmountTax?DateAccountCheck#ToAmountTax?
623/01/21Brokerage1443Checking100No14/02/21SEP-IRA43-255-1276Red Cross75Yes
73/02/21Checking2384Girl Scout Cookies50No12/06/21Brokerage1444NPR150Yes
814/02/21SEP-IRA43-255-1276Red Cross75Yes9/07/21SEP-IRA67-003-9202Molly's School500Yes
922/03/21Checking2385Johnny's Auto125No
1015/04/21Checking2386Grandma200No
1112/06/21Brokerage1444NPR150Yes
129/07/21SEP-IRA67-003-9202Molly's School500Yes
1312/08/21Checking2387Disneyland250No
Sheet4
Cell Formulas
RangeFormula
I6:N8I6=FILTER(B6:G13,G6:G13="Yes","")
Dynamic array formulas.
 
Upvote 0
Solution
I see you have 365 - have you considered using the Filter() function? You can put the formula into a singe cell - I6 for the desired result.
Wow! That a new one for me. I'll check it out. It looks like it will do the job. Thanks.

Can I refer to the table using the table name rather than B6:G13 so that it will update if I add to the table? I'm going to go test that now.

Thanks
 
Upvote 0
Can I refer to the table using the table name rather than B6:G13 so that it will update if I add to the table? I'm going to go test that now.
It probably will update anyway, but makes more sense to directly tie it to the original table name/structure

Excel Formula:
=FILTER(Table1,Table1[Tax?]="Yes","")
 
Upvote 0
It probably will update anyway, but makes more sense to directly tie it to the original table name/structure

Excel Formula:
=FILTER(Table1,Table1[Tax?]="Yes","")
The first time I tried it, I typed "=filter(" and then dragged the cursor over the entire table. That got me this formula =FILTER(Table9[#All],Table9[Tax?]="Yes",""), which gets a #VALUE! error. Then I noticed that your formula has just "Table1" (Table9 in my sheet), so I tried that and got this:

Donations & RMD.xlsx
BCDEFGHIJKLMN
5DateAccountCheck#ToAmountTax?44241SEP-IRA43-255-1276Red Cross75Yes
601/23/21Brokerage1443Checking$100.00No44359Brokerage1444NPR150Yes
702/03/21Checking2384Girl Scout Cookies$50.00No44386SEP-IRA67-003-9202Molly's School500Yes
802/14/21SEP-IRA43-255-1276Red Cross$75.00Yes
903/22/21Checking2385Johnny's Auto$125.00No
1004/15/21Checking2386Grandma$200.00No
1106/12/21Brokerage1444NPR$150.00Yes
1207/09/21SEP-IRA67-003-9202Molly's School$500.00Yes
1308/12/21Checking2387Disneyland$250.00No
MrExcel3
Cell Formulas
RangeFormula
I5:N7I5=FILTER(Table9,Table9[Tax?]="Yes","")
Dynamic array formulas.


It's missing the header row and all of the formatting. How did you get it to look the way it does when you did it?
 
Upvote 0
The first time I tried it, I typed "=filter(" and then dragged the cursor over the entire table. That got me this formula =FILTER(Table9[#All],Table9[Tax?]="Yes",""), which gets a #VALUE! error. Then I noticed that your formula has just "Table1" (Table9 in my sheet), so I tried that and got this:

Donations & RMD.xlsx
BCDEFGHIJKLMN
5DateAccountCheck#ToAmountTax?44241SEP-IRA43-255-1276Red Cross75Yes
601/23/21Brokerage1443Checking$100.00No44359Brokerage1444NPR150Yes
702/03/21Checking2384Girl Scout Cookies$50.00No44386SEP-IRA67-003-9202Molly's School500Yes
802/14/21SEP-IRA43-255-1276Red Cross$75.00Yes
903/22/21Checking2385Johnny's Auto$125.00No
1004/15/21Checking2386Grandma$200.00No
1106/12/21Brokerage1444NPR$150.00Yes
1207/09/21SEP-IRA67-003-9202Molly's School$500.00Yes
1308/12/21Checking2387Disneyland$250.00No
MrExcel3
Cell Formulas
RangeFormula
I5:N7I5=FILTER(Table9,Table9[Tax?]="Yes","")
Dynamic array formulas.


It's missing the header row and all of the formatting. How did you get it to look the way it does when you did it?
I simply copied the header row first.
 
Upvote 0
I simply copied the header row first.
Gotcha. This is the best I could come up with. I actually set the header to be equal. It now updates, too. Notice that I changed "To" to "For" in E5 and L5 changed, too. ?

And I copied the formatting of one of the uncolored rows. This mostly works. I kinda miss the alternating row colors, but I tried converting it to a table and it did not like that at all. It will dynamically expand if I add a matching row to the table, but that new row will not be formatted the same:

Donations & RMD.xlsx
BCDEFGHIJKLMN
5DateAccountCheck#ForAmountTax?DateAccountCheck#ForAmountTax?
601/23/21Brokerage1443Checking$100.00No02/14/21SEP-IRA43-255-1276Red Cross$75.00Yes
702/03/21Checking2384Girl Scout Cookies$50.00No06/12/21Brokerage1444NPR$150.00Yes
802/14/21SEP-IRA43-255-1276Red Cross$75.00Yes07/09/21SEP-IRA67-003-9202Molly's School$500.00Yes
903/22/21Checking2385Johnny's Auto$125.00No44531Checking2388PBS25Yes
1004/15/21Checking2386Grandma$200.00No
1106/12/21Brokerage1444NPR$150.00Yes
1207/09/21SEP-IRA67-003-9202Molly's School$500.00Yes
1308/12/21Checking2387Disneyland$250.00No
1412/01/21Checking2388PBS$25.00Yes
MrExcel3
Cell Formulas
RangeFormula
I5:N5I5=Table9[#Headers]
I6:N9I6=FILTER(Table9,Table9[Tax?]="Yes","")
Dynamic array formulas.


I suppose I could pre-format a bunch of the next rows...

Anyway, this is pretty good. Thanks so much! ??
 
Upvote 0
Gotcha. This is the best I could come up with. I actually set the header to be equal. It now updates, too. Notice that I changed "To" to "For" in E5 and L5 changed, too. ?

And I copied the formatting of one of the uncolored rows. This mostly works. I kinda miss the alternating row colors, but I tried converting it to a table and it did not like that at all. It will dynamically expand if I add a matching row to the table, but that new row will not be formatted the same:

Donations & RMD.xlsx
BCDEFGHIJKLMN
5DateAccountCheck#ForAmountTax?DateAccountCheck#ForAmountTax?
601/23/21Brokerage1443Checking$100.00No02/14/21SEP-IRA43-255-1276Red Cross$75.00Yes
702/03/21Checking2384Girl Scout Cookies$50.00No06/12/21Brokerage1444NPR$150.00Yes
802/14/21SEP-IRA43-255-1276Red Cross$75.00Yes07/09/21SEP-IRA67-003-9202Molly's School$500.00Yes
903/22/21Checking2385Johnny's Auto$125.00No44531Checking2388PBS25Yes
1004/15/21Checking2386Grandma$200.00No
1106/12/21Brokerage1444NPR$150.00Yes
1207/09/21SEP-IRA67-003-9202Molly's School$500.00Yes
1308/12/21Checking2387Disneyland$250.00No
1412/01/21Checking2388PBS$25.00Yes
MrExcel3
Cell Formulas
RangeFormula
I5:N5I5=Table9[#Headers]
I6:N9I6=FILTER(Table9,Table9[Tax?]="Yes","")
Dynamic array formulas.


I suppose I could pre-format a bunch of the next rows...

Anyway, this is pretty good. Thanks so much! ??
Glad we could help, and thanks for the feedback :)
As a point of interest, if you formatted columns I-N with the appropriate formatting down sufficient rows to cover your likely queries, the formatting will be retained as you add rows to the table.
 
Upvote 0
Glad we could help, and thanks for the feedback :)
As a point of interest, if you formatted columns I-N with the appropriate formatting down sufficient rows to cover your likely queries, the formatting will be retained as you add rows to the table.
I also discovered another little M$FT goodie. I added a SUM expression under the Amount column (Col M). When I added a row to the table that needed to be added to the side table, the whole thing turned into a #SPILL! error. (sigh)
 
Upvote 0
I actually set the header to be equal. It now updates, too.
I would probably stick with that for the headers and have the separate formula for the other table data. However, it is possible to do headers and table data all in one if you want. See below.

I suppose I could pre-format a bunch of the next rows...
In terms of Date/Number etc formatting, unless there is a specific reason not to, I would format the whole column. If you format sections of a column, Excel needs to remember individual formatting for the various cells in the column. If you format the whole column, it only needs to remember one for the column. This can help reduce file bloat.


I kinda miss the alternating row colors
It can be achieved with conditional formatting. See below.

I also discovered another little M$FT goodie. I added a SUM expression under the Amount column (Col M). When I added a row to the table that needed to be added to the side table, the whole thing turned into a #SPILL! error. (sigh)
I am surprised that this was "discovery" to you, along with this whole sub-table issue, since much of it was discussed in this other thread of yours.
Consider putting the sum at the top - it is more likely to be readily visible there anyway if your table gets at all big as it would be common in that situation to freeze some rows at the top of the sheet. Two options for that sum in my mini-sheet.

Anyway, here is an option that covers most of what you are wanting as I understand it.
J5:O5 I formatted blue manually (by format-painting from B5:G5). This formatting would not automatically expand to P5 if the original table gets a new column added to it in col H.

The Conditional Formatting shown needs to be applied as far down as you think you will ever need.

JenniferMurphy.xlsm
BCDEFGHIJKLMNO
1
2
3$725.00
4$725.00
5DateAccountCheck#ToAmountTax?DateAccountCheck#ToAmountTax?
623/01/21Brokerage1443Checking$100.00No14/02/21SEP-IRA43-255-1276Red Cross$75.00Yes
73/02/21Checking2384Girl Scout Cookies$50.00No12/06/21Brokerage1444NPR$150.00Yes
814/02/21SEP-IRA43-255-1276Red Cross$75.00Yes9/07/21SEP-IRA67-003-9202Molly's School$500.00Yes
922/03/21Checking2385Johnny's Auto$125.00No
1015/04/21Checking2386Grandma$200.00No
1112/06/21Brokerage1444NPR$150.00Yes
129/07/21SEP-IRA67-003-9202Molly's School$500.00Yes
1312/08/21Checking2387Disneyland$250.00No
Sheet1
Cell Formulas
RangeFormula
N3N3=SUMIF(Table1[Tax?],"Yes",Table1[Amount])
N4N4=SUM(INDEX(J5#,0,COLUMNS(J4:N4)))
J5:O8J5=FILTER(Table1[#All],(Table1[[#All],[Tax?]]="Yes")+(Table1[[#All],[Tax?]]=Table1[[#Headers],[Tax?]]),"")
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
J6:O13Expression=AND(ROWS($J$5#)>=ROW()-ROW($J$5)+1,MOD(ROW()-ROW(J$5),2))textNO
 
Upvote 0

Forum statistics

Threads
1,214,412
Messages
6,119,369
Members
448,888
Latest member
Arle8907

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