- Excel Version
- 365
Using Subtotal on every row of your range table, you can display sequential row numbers for visible rows only. With that you can also fill every other row with a cell color just like a defined Excel Table even when rows are filtered. You can also use ****IFS functions to get results for visible rows only.
Dynamic Row Numbering
The Key to the whole thing is the formula in cell A3. It shows a row number only if the row is visible (not filtered out).
=LET(VIS,SUBTOTAL(103,B3),IF(VIS=1,VIS+MAX(A$2:A2),0))
Dynamic CF
To get Conditional Formatting to fill cell color for alternating rows, use this formula. Even if you filter out rows, the CF will show correctly
=MOD($A3,2)=0
If you want to color every third row use
=MOD($A3,3)=0
Dynamic Functions
And then finally to get the Sum, count, max, min, or average value of just the visible cells, use a formula like this. The bold part specifies to use only cells in column A that are not zero. You can also use FILTER with other functions for a wider variety of results
=COUNTIFS(C3:C162,"Active",A3:A162,"<>"&0)
Dynamic Row Numbering
The Key to the whole thing is the formula in cell A3. It shows a row number only if the row is visible (not filtered out).
=LET(VIS,SUBTOTAL(103,B3),IF(VIS=1,VIS+MAX(A$2:A2),0))
Dynamic CF
To get Conditional Formatting to fill cell color for alternating rows, use this formula. Even if you filter out rows, the CF will show correctly
=MOD($A3,2)=0
If you want to color every third row use
=MOD($A3,3)=0
Dynamic Functions
And then finally to get the Sum, count, max, min, or average value of just the visible cells, use a formula like this. The bold part specifies to use only cells in column A that are not zero. You can also use FILTER with other functions for a wider variety of results
=COUNTIFS(C3:C162,"Active",A3:A162,"<>"&0)
Book2 | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Active Count: | 95 | ||||
2 | VIS ROW | ID | Status | Name | ||
3 | 1 | 840.02 | Active | Jackie | ||
4 | 2 | 1263.13 | Active | Ben | ||
5 | 3 | 1517.7 | Active | John | ||
6 | 4 | 1571.02 | Active | Ben | ||
7 | 5 | 1641.1 | Active | Bill | ||
8 | 6 | 1418.23 | Active | Jeff | ||
9 | 7 | 1571.02 | Active | Ben | ||
10 | 8 | 1392.35 | Active | Alfie | ||
11 | 9 | 1392.41 | Active | Alfie | ||
12 | 10 | 1526.2 | Active | Jenn | ||
Sheet3 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C1 | C1 | =COUNTIFS(C3:C162,"Active",A3:A162,"<>"&0) |
A3:A12 | A3 | =LET(VIS,SUBTOTAL(103,B3),IF(VIS=1,VIS+MAX(A$2:A2),0)) |
Named Ranges | ||
---|---|---|
Name | Refers To | Cells |
_FilterDatabase | =Sheet3!$A$2:$D$162 | A3:A12 |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
A3:D162 | Expression | =MOD($A3,2)=0 | text | NO |
B3:B162 | Expression | =AND(B3<1000,MOD(B3,1)=0) | text | NO |