filter? group? multiple rows based on values in 2 cells

shakethingsup

Board Regular
Joined
May 21, 2017
Messages
64
Office Version
  1. 365
Platform
  1. Windows
[TABLE="width: 500"]
<tbody>[TR]
[TD]Cost center[/TD]
[TD]Dept[/TD]
[TD]Account Desc[/TD]
[TD]Budget[/TD]
[TD]Actual[/TD]
[TD]$ Var[/TD]
[TD]% var[/TD]
[/TR]
[TR]
[TD]712[/TD]
[TD]Acctg[/TD]
[TD]Revenue[/TD]
[TD]10[/TD]
[TD]1[/TD]
[TD]-9[/TD]
[TD]90%[/TD]
[/TR]
[TR]
[TD]712[/TD]
[TD]Acctg[/TD]
[TD]Salaries[/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]-3[/TD]
[TD]60%[/TD]
[/TR]
[TR]
[TD]712[/TD]
[TD]Acctg[/TD]
[TD]Total[/TD]
[TD]5[/TD]
[TD]-7[/TD]
[TD]-12[/TD]
[TD]240%[/TD]
[/TR]
[TR]
[TD]814[/TD]
[TD]HR[/TD]
[TD]Revenue[/TD]
[TD]10[/TD]
[TD]10[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]814[/TD]
[TD]HR[/TD]
[TD]Salaries[/TD]
[TD]11[/TD]
[TD]11[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]814[/TD]
[TD]HR[/TD]
[TD]Total[/TD]
[TD]-1[/TD]
[TD]-1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Let's say I have the above table.

Through any means - formula, VBA (I'm novice) or basic excel filters :

I only want to analyze cost centres with variances in any line that meet my required threshold and hide everything else. Does that make sense?

1. I want to identify absolute $ var > 10 and % var > 10%. In the above example only one row qualifies. 712, Acctg, -12 and 240%.
2. I want to keep all rows associated with the cost center 712
3. I want to hide or delete all rows that don't meet this threshold

Final result:

[TABLE="width: 500"]
<tbody>[TR]
[TD] center[/TD]
[TD]Dept[/TD]
[TD]Account Desc[/TD]
[TD]Budget[/TD]
[TD]Actual[/TD]
[TD]$ Var[/TD]
[TD]% var[/TD]
[/TR]
[TR]
[TD]712[/TD]
[TD]Acctg[/TD]
[TD]Revenue[/TD]
[TD]10[/TD]
[TD]1[/TD]
[TD]-9[/TD]
[TD]90%[/TD]
[/TR]
[TR]
[TD]712[/TD]
[TD]Acctg[/TD]
[TD]Salaries[/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]-3[/TD]
[TD]60%[/TD]
[/TR]
[TR]
[TD]712[/TD]
[TD]Acctg[/TD]
[TD]Total[/TD]
[TD]5[/TD]
[TD]-7[/TD]
[TD]-12[/TD]
[TD]240%[/TD]
[/TR]
</tbody>[/TABLE]

How can I efficiently achieve this? My spreadsheet is 2,000 rows.
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][td="bgcolor:#C0C0C0"]
D​
[/td][td="bgcolor:#C0C0C0"]
E​
[/td][td="bgcolor:#C0C0C0"]
F​
[/td][td="bgcolor:#C0C0C0"]
G​
[/td][td="bgcolor:#C0C0C0"]
H​
[/td][td="bgcolor:#C0C0C0"]
I​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
1​
[/td][td="bgcolor:#F3F3F3"]
Cost center
[/td][td="bgcolor:#F3F3F3"]
Dept
[/td][td="bgcolor:#F3F3F3"]
Account Desc
[/td][td="bgcolor:#F3F3F3"]
Budget
[/td][td="bgcolor:#F3F3F3"]
Actual
[/td][td="bgcolor:#F3F3F3"]
$ Var
[/td][td="bgcolor:#F3F3F3"]
% var
[/td][td="bgcolor:#F3F3F3"]
Filter
[/td][td="bgcolor:#F3F3F3"]
[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
2​
[/td][td]
712​
[/td][td]Acctg[/td][td]Revenue[/td][td]
10​
[/td][td]
1​
[/td][td]
-9​
[/td][td]
90%​
[/td][td="bgcolor:#CCFFCC"]
FALSE​
[/td][td="bgcolor:#CCFFCC"]H2: =AND(ABS(F2)>10, G2 > 10%)[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
3​
[/td][td]
712​
[/td][td]Acctg[/td][td]Salaries[/td][td]
5​
[/td][td]
8​
[/td][td]
-3​
[/td][td]
60%​
[/td][td="bgcolor:#CCFFCC"]
FALSE​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
4​
[/td][td]
712​
[/td][td]Acctg[/td][td]Total[/td][td]
5​
[/td][td]
-7​
[/td][td]
-12​
[/td][td]
240%​
[/td][td="bgcolor:#CCFFCC"]
TRUE​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
5​
[/td][td]
814​
[/td][td]HR[/td][td]Revenue[/td][td]
10​
[/td][td]
10​
[/td][td]
0​
[/td][td]
0​
[/td][td="bgcolor:#CCFFCC"]
FALSE​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
6​
[/td][td]
814​
[/td][td]HR[/td][td]Salaries[/td][td]
11​
[/td][td]
11​
[/td][td]
0​
[/td][td]
0​
[/td][td="bgcolor:#CCFFCC"]
FALSE​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
7​
[/td][td]
814​
[/td][td]HR[/td][td]Total[/td][td]
-1​
[/td][td]
-1​
[/td][td]
0​
[/td][td]
0​
[/td][td="bgcolor:#CCFFCC"]
FALSE​
[/td][td][/td][/tr]
[/table]
 
Upvote 0
[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #C0C0C0"][/TD]
[TD="bgcolor: #C0C0C0"]
A​
[/TD]
[TD="bgcolor: #C0C0C0"]
B​
[/TD]
[TD="bgcolor: #C0C0C0"]
C​
[/TD]
[TD="bgcolor: #C0C0C0"]
D​
[/TD]
[TD="bgcolor: #C0C0C0"]
E​
[/TD]
[TD="bgcolor: #C0C0C0"]
F​
[/TD]
[TD="bgcolor: #C0C0C0"]
G​
[/TD]
[TD="bgcolor: #C0C0C0"]
H​
[/TD]
[TD="bgcolor: #C0C0C0"]
I​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
1​
[/TD]
[TD="bgcolor: #F3F3F3"]
Cost center
[/TD]
[TD="bgcolor: #F3F3F3"]
Dept
[/TD]
[TD="bgcolor: #F3F3F3"]
Account Desc
[/TD]
[TD="bgcolor: #F3F3F3"]
Budget
[/TD]
[TD="bgcolor: #F3F3F3"]
Actual
[/TD]
[TD="bgcolor: #F3F3F3"]
$ Var
[/TD]
[TD="bgcolor: #F3F3F3"]
% var
[/TD]
[TD="bgcolor: #F3F3F3"]
Filter
[/TD]
[TD="bgcolor: #F3F3F3"][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
2​
[/TD]
[TD]
712​
[/TD]
[TD]Acctg[/TD]
[TD]Revenue[/TD]
[TD]
10​
[/TD]
[TD]
1​
[/TD]
[TD]
-9​
[/TD]
[TD]
90%​
[/TD]
[TD="bgcolor: #CCFFCC"]
FALSE​
[/TD]
[TD="bgcolor: #CCFFCC"]H2: =AND(ABS(F2)>10, G2 > 10%)[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
3​
[/TD]
[TD]
712​
[/TD]
[TD]Acctg[/TD]
[TD]Salaries[/TD]
[TD]
5​
[/TD]
[TD]
8​
[/TD]
[TD]
-3​
[/TD]
[TD]
60%​
[/TD]
[TD="bgcolor: #CCFFCC"]
FALSE​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
4​
[/TD]
[TD]
712​
[/TD]
[TD]Acctg[/TD]
[TD]Total[/TD]
[TD]
5​
[/TD]
[TD]
-7​
[/TD]
[TD]
-12​
[/TD]
[TD]
240%​
[/TD]
[TD="bgcolor: #CCFFCC"]
TRUE​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
5​
[/TD]
[TD]
814​
[/TD]
[TD]HR[/TD]
[TD]Revenue[/TD]
[TD]
10​
[/TD]
[TD]
10​
[/TD]
[TD]
0​
[/TD]
[TD]
0​
[/TD]
[TD="bgcolor: #CCFFCC"]
FALSE​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
6​
[/TD]
[TD]
814​
[/TD]
[TD]HR[/TD]
[TD]Salaries[/TD]
[TD]
11​
[/TD]
[TD]
11​
[/TD]
[TD]
0​
[/TD]
[TD]
0​
[/TD]
[TD="bgcolor: #CCFFCC"]
FALSE​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
7​
[/TD]
[TD]
814​
[/TD]
[TD]HR[/TD]
[TD]Total[/TD]
[TD]
-1​
[/TD]
[TD]
-1​
[/TD]
[TD]
0​
[/TD]
[TD]
0​
[/TD]
[TD="bgcolor: #CCFFCC"]
FALSE​
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Hi - thanks for the response.

Yes that helps get the true false.

Now I want to hide or delete all rows with cost centre 814.
and I want to keep all rows with cost centre 712 because one row met the criteria.

I'm missing that piece.
 
Upvote 0
[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #C0C0C0"][/TD]
[TD="bgcolor: #C0C0C0"]
A​
[/TD]
[TD="bgcolor: #C0C0C0"]
B​
[/TD]
[TD="bgcolor: #C0C0C0"]
C​
[/TD]
[TD="bgcolor: #C0C0C0"]
D​
[/TD]
[TD="bgcolor: #C0C0C0"]
E​
[/TD]
[TD="bgcolor: #C0C0C0"]
F​
[/TD]
[TD="bgcolor: #C0C0C0"]
G​
[/TD]
[TD="bgcolor: #C0C0C0"]
H​
[/TD]
[TD="bgcolor: #C0C0C0"]
I​
[/TD]
[TD="bgcolor: #C0C0C0"][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
1​
[/TD]
[TD="bgcolor: #F3F3F3"]
Cost center
[/TD]
[TD="bgcolor: #F3F3F3"]
Dept
[/TD]
[TD="bgcolor: #F3F3F3"]
Account Desc
[/TD]
[TD="bgcolor: #F3F3F3"]
Budget
[/TD]
[TD="bgcolor: #F3F3F3"]
Actual
[/TD]
[TD="bgcolor: #F3F3F3"]
$ Var
[/TD]
[TD="bgcolor: #F3F3F3"]
% var
[/TD]
[TD="bgcolor: #F3F3F3"]
Filter
[/TD]
[TD="bgcolor: #F3F3F3"][/TD]
[TD="bgcolor: #F3F3F3"]Action[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
2​
[/TD]
[TD]
712​
[/TD]
[TD]Acctg[/TD]
[TD]Revenue[/TD]
[TD]
10​
[/TD]
[TD]
1​
[/TD]
[TD]
-9​
[/TD]
[TD]
90%​
[/TD]
[TD="bgcolor: #CCFFCC"]
FALSE​
[/TD]
[TD="bgcolor: #CCFFCC"]H2: =AND(ABS(F2)>10, G2 > 10%)[/TD]
[TD="bgcolor: #CCFFCC"]Keep[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
3​
[/TD]
[TD]
712​
[/TD]
[TD]Acctg[/TD]
[TD]Salaries[/TD]
[TD]
5​
[/TD]
[TD]
8​
[/TD]
[TD]
-3​
[/TD]
[TD]
60%​
[/TD]
[TD="bgcolor: #CCFFCC"]
FALSE​
[/TD]
[TD][/TD]
[TD]Keep[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
4​
[/TD]
[TD]
712​
[/TD]
[TD]Acctg[/TD]
[TD]Total[/TD]
[TD]
5​
[/TD]
[TD]
-7​
[/TD]
[TD]
-12​
[/TD]
[TD]
240%​
[/TD]
[TD="bgcolor: #CCFFCC"]
TRUE​
[/TD]
[TD][/TD]
[TD]Keep[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
5​
[/TD]
[TD]
814​
[/TD]
[TD]HR[/TD]
[TD]Revenue[/TD]
[TD]
10​
[/TD]
[TD]
10​
[/TD]
[TD]
0​
[/TD]
[TD]
0​
[/TD]
[TD="bgcolor: #CCFFCC"]
FALSE​
[/TD]
[TD][/TD]
[TD]Hide/Delete[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
6​
[/TD]
[TD]
814​
[/TD]
[TD]HR[/TD]
[TD]Salaries[/TD]
[TD]
11​
[/TD]
[TD]
11​
[/TD]
[TD]
0​
[/TD]
[TD]
0​
[/TD]
[TD="bgcolor: #CCFFCC"]
FALSE​
[/TD]
[TD][/TD]
[TD]Hide/Delete[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
7​
[/TD]
[TD]
814​
[/TD]
[TD]HR[/TD]
[TD]Total[/TD]
[TD]
-1​
[/TD]
[TD]
-1​
[/TD]
[TD]
0​
[/TD]
[TD]
0​
[/TD]
[TD="bgcolor: #CCFFCC"]
FALSE​
[/TD]
[TD][/TD]
[TD]Hide/Delete[/TD]
[/TR]
</tbody>[/TABLE]


I decided to add another column called action to show what I want to achieve. Row 4 met the criteria of being true. So now, I want every line of 712 to be kept.
 
Upvote 0
I think I figured one step at least

{IF(ISNUMBER(MATCH($A$2:$A$11,$J$2:$J$11,0)),$A$2:$A$11)}
 
Upvote 0
[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][td="bgcolor:#C0C0C0"]
D​
[/td][td="bgcolor:#C0C0C0"]
E​
[/td][td="bgcolor:#C0C0C0"]
F​
[/td][td="bgcolor:#C0C0C0"]
G​
[/td][td="bgcolor:#C0C0C0"]
H​
[/td][td="bgcolor:#C0C0C0"]
I​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
1​
[/td][td="bgcolor:#F3F3F3"]
Cost center
[/td][td="bgcolor:#F3F3F3"]
Dept
[/td][td="bgcolor:#F3F3F3"]
Account Desc
[/td][td="bgcolor:#F3F3F3"]
Budget
[/td][td="bgcolor:#F3F3F3"]
Actual
[/td][td="bgcolor:#F3F3F3"]
$ Var
[/td][td="bgcolor:#F3F3F3"]
% var
[/td][td="bgcolor:#F3F3F3"]
Filter
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
2​
[/td][td]
712​
[/td][td]Acctg[/td][td]Revenue[/td][td]
10​
[/td][td]
1​
[/td][td]
-9​
[/td][td]
90%​
[/td][td="bgcolor:#CCFFCC"]
TRUE​
[/td][td="bgcolor:#CCFFCC"]H2: =SUMPRODUCT(($A$2:$A$7 = A2) * (ABS($F$2:$F$7) > 10 ) * ($G$2:$G$7 > 10%)) > 0[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
3​
[/td][td]
712​
[/td][td]Acctg[/td][td]Salaries[/td][td]
5​
[/td][td]
8​
[/td][td]
-3​
[/td][td]
60%​
[/td][td="bgcolor:#CCFFCC"]
TRUE​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
4​
[/td][td]
712​
[/td][td]Acctg[/td][td]Total[/td][td]
5​
[/td][td]
-7​
[/td][td]
-12​
[/td][td]
240%​
[/td][td="bgcolor:#CCFFCC"]
TRUE​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
5​
[/td][td]
814​
[/td][td]HR[/td][td]Revenue[/td][td]
10​
[/td][td]
10​
[/td][td]
0​
[/td][td]
0​
[/td][td="bgcolor:#CCFFCC"]
FALSE​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
6​
[/td][td]
814​
[/td][td]HR[/td][td]Salaries[/td][td]
11​
[/td][td]
11​
[/td][td]
0​
[/td][td]
0​
[/td][td="bgcolor:#CCFFCC"]
FALSE​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
7​
[/td][td]
814​
[/td][td]HR[/td][td]Total[/td][td]
-1​
[/td][td]
-1​
[/td][td]
0​
[/td][td]
0​
[/td][td="bgcolor:#CCFFCC"]
FALSE​
[/td][td][/td][/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

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