=IF(ISBLANK(A2),"",COUNTA(A$2:A2))
=IF(A2="", "", COUNTIFS(A$2:A2, A2, B$2:B2, "<>")) numerar celdas en excel con condiciones
SUBTOTAL(103, A2) checks if the current row is visible (returning 1 if visible, 0 if hidden or filtered). If visible, the second SUBTOTAL(103, A$2:A2) counts the number of visible cells in the expanding range. This creates a sequential, gapless index that updates instantly when you change the filter. the second SUBTOTAL(103
=LET( visible, SUBTOTAL(103, A2), group, A2, IF(visible, COUNTIFS(A$2:A2, group, SUBTOTAL(103, OFFSET(A$2, ROW(A$2:A2)-ROW(A$2), 0)), 1), "") ) (This is a conceptual simplification; the actual implementation often requires helper columns for performance.) you enter: that also ignores blanks:
The solution lies in a counter-intuitive use of COUNTIF or COUNTA with a mixed reference. In cell B2, you enter:
that also ignores blanks: